Delete certain rows

  • Thread starter Thread starter Annette
  • Start date Start date
A

Annette

How do I programically find and delete only rows with "* / *" in column D?
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top