happymacro
New Member
- Joined
- Nov 4, 2017
- Messages
- 18
Hi there.
I am trying to delete any rows that have specific texts such as "car", "labor", "bat" for one of the sheet say sheet2 but my macro doesn't seem to work right. appreciate your help.
Sub deleterow()
For i = last To 1 Step -1
If (Cells(i, "A").Value) = "Labor" Then
Cells(i, "A").EntireRow.Delete
If (Cells(i, "A").Value) = "car" Then
Cells(i, "A").EntireRow.Delete
If (Cells(i, "A").Value) = "bat" Then
Cells(i, "A").EntireRow.Delete
If (Cells(i, "A").Value) = "apple" Then
Cells(i, "A").EntireRow.Delete
End If
Next i
End Sub
I am trying to delete any rows that have specific texts such as "car", "labor", "bat" for one of the sheet say sheet2 but my macro doesn't seem to work right. appreciate your help.
Sub deleterow()
For i = last To 1 Step -1
If (Cells(i, "A").Value) = "Labor" Then
Cells(i, "A").EntireRow.Delete
If (Cells(i, "A").Value) = "car" Then
Cells(i, "A").EntireRow.Delete
If (Cells(i, "A").Value) = "bat" Then
Cells(i, "A").EntireRow.Delete
If (Cells(i, "A").Value) = "apple" Then
Cells(i, "A").EntireRow.Delete
End If
Next i
End Sub