Trouble with this code
There isn't an activecell as such since you aren't selecting cells
through this loop.
this code deletes the rows contents if cell isn't = HO
replace with Range("E" & RowNdx).ClearContents for just the cewll in
column E
Sub clearnotHO()
LastRow = Cells(Rows.Count, "E").End(xlUp).Row
For RowNdx = LastRow To 1 Step -1
If StrComp(Cells(RowNdx, "E"), "HO", vbTextCompare) Then
Rows(RowNdx).ClearContents
End If
Next RowNdx
End Sub
somethinglikeant
JOUIOUI wrote:
I'm not sure what is wroing with this code, my goal is to clear any text in
Column E that does not match "HO". Any help is appreciated. Thanks
LastRow = Cells(Rows.Count, "E").End(xlUp).Row
For RowNdx = LastRow To 1 Step -1
If StrComp(Cells(RowNdx, "E"), "HO", vbTextCompare) Then
Rows(RowNdx)ActiveCell.ClearContents
End If
Next RowNdx
|