Question : Remove data row

Hi Experts,

I need Experts help to rewrite the attached script. Need to remove another data row if the column_C has this word "Test1/Test2/Test3" besides "Cue". Hope Experts could help to revise this code.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
Sub Cue2()
 
Dim rFind As Range

Application.ScreenUpdating = False

With Sheets("System").Columns(3)
    Set rFind = .Find(What:="cue", LookAt:=xlPart, MatchCase:=False, SearchFormat:=False)
    If Not rFind Is Nothing Then
        Do
            rFind.EntireRow.Delete
            Set rFind = .Find(What:="cue", LookAt:=xlPart, MatchCase:=False, SearchFormat:=False)
        Loop Until rFind Is Nothing
    End If
End With
     
Application.ScreenUpdating = True
     
End Sub

Answer : Remove data row

If you iterate through the rows in reverse order and delete them from the bottom up you dont have to worry about your index being off.  something like the following would work...

Private Sub CommandButton1_Click()
For I = ActiveCell.SpecialCells(xlLastCell).Row To 1 Step -1
   If Cells(I, 3) = "Test1/Test2/Test3" Then
     Rows(I).Delete
   End If
Next I
End Sub
Random Solutions  
 
programming4us programming4us