Hi,
I am totally new with VBA and was trying to make a macro deleting rows based on certain criteria. With one criteria it worked just fine, but I am struggling to add a second criteria. In short, below the code that I have so far. I need it to delete all rows that do not contain "Sales" in column C and "Bonus" in column G. Could anyone help?
Application.ScreenUpdating = False
With Range("C3", Range("C" & Rows.Count).End(xlUp))
.AutoFilter Field:=1, Criteria1:="<>*Sales*"
.Offset(1).EntireRow.Delete
.AutoFilter
End With
Application.ScreenUpdating = True
I am totally new with VBA and was trying to make a macro deleting rows based on certain criteria. With one criteria it worked just fine, but I am struggling to add a second criteria. In short, below the code that I have so far. I need it to delete all rows that do not contain "Sales" in column C and "Bonus" in column G. Could anyone help?
Application.ScreenUpdating = False
With Range("C3", Range("C" & Rows.Count).End(xlUp))
.AutoFilter Field:=1, Criteria1:="<>*Sales*"
.Offset(1).EntireRow.Delete
.AutoFilter
End With
Application.ScreenUpdating = True