Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50236

VBA code for deleting Rows that contain specific criteria from Filtered Data

$
0
0
Hello,

I am trying to delete the entire row/rows of specific data from a filtered table. As an example, I have data in columns A1:E600. From Column B, I want to delete the rows that contain the text "Active".

I have a used the following macro, but I am stuck when I want to remove the filter. Then filter on a different column and delete the criteria in that column.

Code:

   
  Worksheets("Sheet1").Range("A1").AutoFilter Field:=1, Criteria1:="Active"
    Application.DisplayAlerts = False
    ActiveSheet.UsedRange.Offset(1, 0).Resize(ActiveSheet.UsedRange.Rows.Count - 1).Rows.Delete
    Application.DisplayAlerts = True
    Selection.AutoFilter

Can someone please help or refer me to a great link?? Also, if there is a cleaner way than this code, please advise.

Thanks in advance!

Viewing all articles
Browse latest Browse all 50236

Trending Articles