My current FOR-NEXT loop works as long as the IF-THEN condition is met. However, as soon as the IF-THEN condition is not met, the loop stops. I want the loop to continue, even if the IF-THEN condition is not met. I want to check ALL lines in the table. New to VBA. Any help is appreciated.
Dim EngHisTable As ListObject
Set EngHisTable = Sheets("Historic").ListObjects("Table2")
Dim WeekCode As String
WeekCode = Sheets("Weekly").Range("B5").Value
For x = EngHisTable.ListRows.Count To 1 Step -1
If EngHisTable.ListRows(EngHisTable.ListRows.Count).Range(, 15) = WeekCode Then EngHisTable.ListRows(EngHisTable.ListRows.Count).Delete End If
Next x
Aucun commentaire:
Enregistrer un commentaire