M
mattg
I'm trying to use this mcaro to delete rowsa based on the value of Column B
and it isn't working
Sub DeleteCM()
lastrow = Cells(Rows.Count, "B").End(xlUp).Row
Set myrange = Range("B2:B" & lastrow)
For Each Count In myrange
If Count.Value = "CM" Then
Count.EntireRow.Delete
End If
Next
End Sub
Any help would be appreciated.
BTW there are 2 other values I want to delete the rows if they exist "IC"
and "MG". Do I need 3 separate macros?
and it isn't working
Sub DeleteCM()
lastrow = Cells(Rows.Count, "B").End(xlUp).Row
Set myrange = Range("B2:B" & lastrow)
For Each Count In myrange
If Count.Value = "CM" Then
Count.EntireRow.Delete
End If
Next
End Sub
Any help would be appreciated.
BTW there are 2 other values I want to delete the rows if they exist "IC"
and "MG". Do I need 3 separate macros?