Delete certain rows

  • Thread starter Thread starter Annette
  • Start date Start date
Hi Annette
try
Sub delete_rows()
Dim RowNdx As Long
Dim LastRow As Long

LastRow = ActiveSheet.Cells(Rows.Count, "D").End(xlUp).row
For RowNdx = LastRow To 1 Step -1
If Cells(RowNdx, "D").Value = "* /*" Then
Rows(RowNdx).Delete
End If
Next RowNdx
End Sub
 
oops ... I didn't ask this right ... what if it is wild card ... any text
before "/" and any text after ...
 
Hi Annette
do you want to delete the entire row if column D contains the sign '/'.
If yes change the line
If Cells(RowNdx, "D").Value = "* /*" Then

to
If InStr(Cells(RowNdx, "D").Value, "/") Then
 
Back
Top