I'm running into an issue where my vba macro is getting stuck and excel freezes. I have narrowed it down to the do until loop but can't seem to get past it. I've tried adding forced wait times to see if that would help but to no avail.
The purpose of the macro is to delete all rows under specific headers until only one row with the value 'Net Change' is remaining. So in the example below only the Headers and the 'Net Change' rows will remain. As always any help is appreciated.
Edit 1: All other rows in the worksheet need to remain intact when running this macro. My thought process was locate the header from the array and delete the unwanted rows beneath it and continue to the next header. There are other headers with information I still need to see.
Sub Delete_Rows_NotNetChange()
Dim deleteNotNetChange As Variant
Dim sr As Range
Dim fr As Range
With ActiveSheet
Set sr = ActiveSheet.Range("A:A")
Application.ScreenUpdating = False
deleteNotNetChange = Array("4008 - Tenant Paid Trash Fee", "4015 - Guardian Water (Mulberry)", "6003 - Leasing Fee (3rd Party)", _
"6277 - Property Cleaning", "6403 - Water", "6408 - Trash and Recycling", "6515 - Parking Garage", "6612 - Property Manager Salary", _
"6622 - Workman's Comp Insurance", "6633 - Coffee Bar / Machine Supplies", "6639 - Telephone Service")
For Each Header In deleteNotNetChange
On Error Resume Next
Range(Cells.Find(Header).Address).Select
ActiveCell.Offset(1, 0).Select
Do Until InStr(1, ActiveCell.Value, "Net Change") > 0
On Error Resume Next
ActiveCell.EntireRow.Delete
Loop
Next Header
Application.ScreenUpdating = True
End With
End Sub