VBA to turn on AutoFilter even if already on

General Ledger

Active Member
Joined
Dec 31, 2007
Messages
460
I want code to turn on the AutoFilter. The code I have below acts more like a toggle. If AutoFilter is off, this code turns it on. If AutoFilter is on, this code turns it off.

Is there code that turns on AutoFilter regardless of the current state?


Code:
    Range("A1:I1").AutoFilter
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Perfect Solution!

This code checks the state of AutoFilter. If off, turn it on. If on, leave it on.

Code:
    If Not ActiveSheet.AutoFilterMode Then
        ActiveSheet.Range("A1:I1").AutoFilter
    End If

Thanks wigi!
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,909
Members
452,949
Latest member
beartooth91

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