NKlawender
New Member
- Joined
- Apr 5, 2022
- Messages
- 21
- Office Version
- 365
- Platform
- Windows
I ran this code lasst month and it worked perfectly, now this month, it is giving me an error. I have no idea why. Any ideas?
Dim LastA As Long
With Sheets("Sheet1")
LastA = .Range("A" & Rows.Count).End(xlUp).Row
Application.ScreenUpdating = False
For r = LastA To 2 Step -1
If .Cells(r, "S") = "<Not defined>" And Cells(r, "T") = "<Not defined>" Then .Cells(r, "A").EntireRow.Delete
If .Cells(r, "S") = "." And Cells(r, "T") = "." Then .Cells(r, "A").EntireRow.Delete
If .Cells(r, "S") = "na" And Cells(r, "T") = "na" Then .Cells(r, "A").EntireRow.Delete
If .Cells(r, "S") = "n/a" And Cells(r, "T") = "n/a" Then .Cells(r, "A").EntireRow.Delete
Next r
End With
Application.ScreenUpdating = True
The red part is what is highlighted when I hit Debug.
Thanks,
Norm
Dim LastA As Long
With Sheets("Sheet1")
LastA = .Range("A" & Rows.Count).End(xlUp).Row
Application.ScreenUpdating = False
For r = LastA To 2 Step -1
If .Cells(r, "S") = "<Not defined>" And Cells(r, "T") = "<Not defined>" Then .Cells(r, "A").EntireRow.Delete
If .Cells(r, "S") = "." And Cells(r, "T") = "." Then .Cells(r, "A").EntireRow.Delete
If .Cells(r, "S") = "na" And Cells(r, "T") = "na" Then .Cells(r, "A").EntireRow.Delete
If .Cells(r, "S") = "n/a" And Cells(r, "T") = "n/a" Then .Cells(r, "A").EntireRow.Delete
Next r
End With
Application.ScreenUpdating = True
The red part is what is highlighted when I hit Debug.
Thanks,
Norm