Hi,
I am trying to create a macro that will delete multiple rows at once, based on different criteria. The rows need to be selected first and deleted simultaneously. My code seems to "forget" the first selection and only delete the rows from the last if-statement. Any help would be greatly appreciated. Here is what I have tried:
I am trying to create a macro that will delete multiple rows at once, based on different criteria. The rows need to be selected first and deleted simultaneously. My code seems to "forget" the first selection and only delete the rows from the last if-statement. Any help would be greatly appreciated. Here is what I have tried:
Code:
If condition1 = 0 Then
Sheets("Sheet1").Select
Range("1:1,2:2,4:4").Select
Range("A4").Activate
End If
If condition2 = 0 Then
Sheets("Sheet1").Select
Range("5:5,6:6,8:8").Select
Range("A8").Activate
End If
Selection.Delete Shift:=xlUp
End Sub