VBA - autofilter Table for non-zero items

velohead

Board Regular
Joined
Aug 22, 2007
Messages
222
Office Version
  1. 365
Hi All,

I have a table that is always Table1, but is always a different size, i.e. number of rows long and/or number of columns wide.
I always wish to filter the table to exclude zero value items (in a certain column) (always the same column).
When I record a macro, the macro seems to find what is not zero, and put that array into the macro.
example of recorded line -> ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=3, Criteria1:=Array("10", "100", "21", "4", "5"), Operator:=xlFilterValues
In my test spread sheet this is only a few items, however in my live macro it may be tens or hundreds, not just a few.

So, how do I get a macro that will filter non-zero items.

Thx.
Excel 365.

Data for table 1.....(you can copy/paste this, then make a table)...
RefBeverageSales
1Coke10
2Fanta100
3Pepsi21
4Dr Pepper0
5Seven Up5
6Tango4
 

Forum statistics

Threads
1,226,880
Messages
6,193,475
Members
453,802
Latest member
SarahNoob

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