Filter and delete visible rows

paldob

New Member
Joined
Apr 23, 2018
Messages
28
Hi All,

Could anyone provide me with a simple way to do the following

  • Sheet1 (my main worksheet)
  • Cell A2 is my Filter Title
  • Cell A3:CH3 downwards contains the information I wish to filter
  • I want to filter column A (Data From A3 to Axxx) to select the word DELETE (I have a routine to mark duplicate information as DELETE) I then want to remove all visible rows that contain the word delete in column A

Is this possible?

Thank you
P
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Try this:

Code:
Application.ScreenUpdating = False
 
Dim lr As Long

With Sheets("Sheet1")
    If .AutoFilterMode Then .AutoFilterMode = False
    lr = .Range("A" & .Rows.Count).End(xlUp).Row
    If lr < 4 Then Exit Sub
    With .Range("A3:A" & lr)
        .AutoFilter
        .AutoFilter Field:=1, Criteria1:="DELETE"
        If .SpecialCells(xlCellTypeVisible).Count > 1 Then
            .Offset(1, 0).Resize(lr - 1).SpecialCells(xlCellTypeVisible).EntireRow.Delete
        End If
    End With
    .AutoFilterMode = False
End With

Application.ScreenUpdating = True
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top