View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Delete Row meeting a Criteria

Try something like the following:

Dim RowNdx As Long
Dim LastRow As Long
LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For RowNdx = LastRow To 1 Step -1
If Cells(RowNdx, "A").Value = "DUP" Then
Rows(RowNdx).Delete
End If
Next RowNdx

This will delete all the rows that have "DUP" in column A.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"SRS Man" wrote in message
...
Is there a way to delete a row that meets a certain criteria

using VBA.

For example, my spreadsheet has 100 rows and I want to delete

every row that
has the word "DUP" in it. They will be spreadout over the 100

rows.

Please let me know.

Thanks