Can anyone tell me why this clears the contents of each row correctly:
But this does not delete the proper rows:
Is it because the Delete method is changing the row count? Any suggestions on how to fix?
Code:
For Each c In Range("B9:B" & Range("B" & Rows.Count).End(xlUp).Row)
If c.Value <> Range("A2") Then c.EntireRow.ClearContents
Next c
But this does not delete the proper rows:
Code:
For Each c In Range("B9:B" & Range("B" & Rows.Count).End(xlUp).Row)
If c.Value <> Range("A2") Then c.EntireRow.Delete
Next c
Is it because the Delete method is changing the row count? Any suggestions on how to fix?