I am currently using the following code to check column A in a specific cell range for # N / A, and if it is found, I will delete that row.
With Sheets(Sheet)
For LRow = 45 To 29 Step -1
With .Cells(LRow, "A")
If (CVErr(.Value) = CVErr(xlErrNA)) Then .EntireRow.Delete
End With
Next LRow
End With
I need to expand this, so I check all columns 1 through 10, not just A. I tried this small modification (a nested loop still), but it does not work. Any suggestions?
With Sheets(Sheet)
For LRow = 45 To 29 Step -1
For LCol = 10 To 1 Step -1
With .Cells(LRow, LCol)
If (CVErr(.Value) = CVErr(xlErrNA)) Then .EntireRow.Delete
End With
Next LCol
Next LRow
End With
source
share