So, only half the records which are searched for is getting deleted. PFB the code snippet. Ex: 32 instances of CityName exist. Only 16 gets deleted.
i As Long, lngEndRowInv As Long
Set wsh = ThisWorkbook.ActiveSheet
i = 1
lngEndRowInv = wsh.Range("A" & Rows.Count).End(xlUp).Row
While i <= lngEndRowInv
If Cells(i, "A") = "CityName" Then
Cells(i, "A").EntireRow.Delete
End If
i = i + 1
Wend
Does this have to do with the reverse approach? Any help or direction is appreciated. Thanks!
It’s because if you delete row 2, then what was previously row 3 is now row 2. So you need to offset your references every time you delete a row