I have a loop that goes through ~15K rows, checks if a value exists in an array and deletes the row if not. I have been using this loop for months with no problem. Now, each loop is taking approx 2 seconds and I have no idea why. I have done the usual "set calculations to manual" and "turn off screen update" settings with no improvement.
Sorry but the data is confidential so I can't give you guys the source files
For lngCounter = lngLastrowresults To 3 Step -1
On Error GoTo Handler
If IsError(Application.Match(Range(Mid(strProjLoc, 2, 1) & CStr(lngCounter)), arrProjectID, False)) Then
Range("B" & CStr(lngCounter)).EntireRow.Delete
Debug.Print lngCounter
End If
Next lngCounter
Any ideas?
Update1: I closed out of Excel and reopened and started the loop again. It began running quickly but is getting slower time.
Update2: I isolated the loop and have been F8ing through the lines. The line that stalls is "Range("B" & CStr(lngCounter)).EntireRow.Delete". It seems to be taking a long time to actually delete the row.