我正在尝试在多个工作表的工作簿中删除包含 ISIN 值的行。
我可以删除几张纸中的 ISIN,但不能删除校准表和燃料和质量表。
Sub del()
Dim num As Integer
Dim del As String
Dim q As Integer
Dim a As Integer
Dim i As Integer
num = Range("A" & Rows.Count).End(xlUp).Row
del = InputBox("Enter ISIN", "ISIN")
a = Application.Worksheets.Count
For q = 1 To a
Worksheets(q).Activate
If ActiveSheet.Name = "Price Selection for Upload" Then
For i = 1 To num
If Range("A" & i).Value = del Then
ActiveSheet.Rows(i).EntireRow.Delete
End If
Next i
ElseIf ActiveSheet.Name = "Main Sheet" Then
For i = 1 To num
If Range("A" & i).Value = del Then
ActiveSheet.Rows(i).EntireRow.Delete
End If
Next i
ElseIf ActiveSheet.Name = "Spread Calibration" Then
For i = 1 To num
If Range("A" & i).Value = del Then
ActiveSheet.Rows(i).EntireRow.Delete
End If
Next i
ElseIf ActiveSheet.Name = "Fuel& Quality" Then
For i = 1 To num
If Range("B" & i).Value = del Then
ActiveSheet.Rows(i).EntireRow.Delete
End If
Next i
ElseIf ActiveSheet.Name = "Sheet3" Then
Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Select
ActiveCell.Value = del
End If
Next q
Worksheets("Email Details").Activate
Worksheets("Email Details").Range("Q2").Select
End Sub