How to filter excluding certain words and delete the rows?

alphabo1201

New Member
Joined
May 2, 2019
Messages
16
Hello Excel Gurus,

I am trying to filter exclude and deleting any rows but for some reason it is deleting all of the rows. Could someone help me?

the filter portion of the VBA works but its the deleting rows that is not working.... Thank you!!

Range("A1").AutoFilter Field:=13, Criteria1:="<>EXPENSES", Operator:=xlFilterValues
Application.DisplayAlerts = False
ActiveSheet.AutoFilter.Range.Offset(1, 0).Rows.SpecialCells(xlCellTypeVisible).Delete (xlShiftUp)
Application.DisplayAlerts = True
ActiveSheet.ShowAllData
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
How about
VBA Code:
   With ActiveSheet
      .Range("A1:M1").AutoFilter 13, "<>Expenses"
      .AutoFilter.Range.Offset(1).EntireRow.Delete
      .AutoFilterMode = False
   End With
 
Upvote 0
How about
VBA Code:
   With ActiveSheet
      .Range("A1:M1").AutoFilter 13, "<>Expenses"
      .AutoFilter.Range.Offset(1).EntireRow.Delete
      .AutoFilterMode = False
   End With
Thank you very much!!! appreciate the insight. I was able to fix the issue.!
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,996
Messages
6,122,636
Members
449,092
Latest member
bsb1122

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