我已经创建了一些编码,用于循环访问数据集并根据所需条件删除行。我需要帮助,因为它会删除第一个找到的匹配条件,但不会循环访问其余的数据。我错过了什么?许多谢谢VBA循环和删除问题
Sub RemoveFivePoundException()
Dim I As Integer
Dim LR As Long
Application.ScreenUpdating = False
Sheets("Claims").Select
LR = Cells(Rows.Count, "A").End(xlUp).row
Range("a1").Select
For I = 3 To LR
If Cells(I, 6).Value > 5# And Cells(I, 7) = "Under £5 write off" Then
Cells(I, 1).EntireRow.Delete
End If
Next I
Application.ScreenUpdating = True
End Sub
[Excel VBA删除行]的可能重复(https://stackoverflow.com/questions/35042717/excel-vba-delete-rows) –