我已經創建了一些編碼,用於循環訪問數據集並根據所需條件刪除行。我需要幫助,因爲它會刪除第一個找到的匹配條件,但不會循環訪問其餘的數據。我錯過了什麼?許多謝謝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) –