VBA to Filter / Unfilter

Dazzybeeguy

Board Regular
Joined
Jan 6, 2022
Messages
118
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
I want to assign a Macro that unfilters to remove any blanks or values of Zero. When I record a Macro for this it works fine but as soon as another value is entered it does not work, it only filters it to all the options that were there when the macro was recorded. So as per example below if that column then showed Name7 it would not be in the filtered list.

ActiveSheet.Range("$A$3:$DL$1567").AutoFilter Field:=24, Criteria1:=Array( _
"1", "a", "Name1", "Name2", "Name3", "Name4", "Name5", "Name6", "v"), Operator _
:=xlFilterValues
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
If you want to hide blanks & zeros, try
Excel Formula:
ActiveSheet.Range("$A$3:$DL$1567").AutoFilter 24, "<>0", xlAnd, "<>"
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,121
Members
453,021
Latest member
Justyna P

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