Autofilter help

scottc786

New Member
Joined
Jun 9, 2008
Messages
42
Hi Guys - Does anyone know how i can test to see if the autofilter, while enabled, is not currently filtering?

Tks
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
I'm not entirely sure what you mean, so forgive me if this explanation is of no use to you.

You'll know when you are filterin data if you look at the row numbers to the left of the xl screen. They change to a blue colour and they hide certain rows which doesn't contain the active filter.
You can then clik on the filter arrow and select "All" to show all the data in that criteria column.

Again, apologies if this isn't the answer you were looking for, I just don't fully understand your question.

Regards
 
Upvote 0
sorry..... to make myself a touch clearer.... In vb how can i test, if the autofilter is on, but everything is set to 'All' (i.e. is currently having no effect)
 
Upvote 0
This will tell you if it is filtering or not:

Code:
Sub testFilter()
For Each f In ActiveSheet.AutoFilter.Filters
    If f.On = True Then
        MsgBox "Filter is applied in one of your columns"
        Exit Sub
    End If
Next f
MsgBox "Filter is not applied"
End Sub
Hope that helps.
 
Upvote 0
You could also, if you really wanted to, have it return columns that are currently filtered and other things, but not sure what you want as an end result?
 
Upvote 0
How would i do that?

I have a box that need to change value depending on if the filter is set or not in the 3rd colum.... it can be active on the others though and it not matter.

Tks
 
Upvote 0
Maybe have a look into this and modify to your needs:

Code:
Sub testFilter()
For Each f In ActiveSheet.AutoFilter.Filters
    If f.On = True Then
        MsgBox "Column " & ActiveSheet.AutoFilter.Range.Resize(1, 1).Offset(, counter).Address(0, 0) & " is filtered on"
        Exit Sub
    End If
    counter = counter + 1
Next f
MsgBox "Filter is not applied"
End Sub
This only checks for the first instance of something being filtered and not all instances. Remove the exit sub if you want all instances and you will probably need to change how the last message box is displayed.

Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,214,830
Messages
6,121,831
Members
449,051
Latest member
excelquestion515

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