Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

excel autofilter - check if activated/deactivated 1

Status
Not open for further replies.

littlewoman

Programmer
Jan 7, 2005
34
0
0
NL
using excel 2003-vba

since the autofilter is turned on and off by the same command I need to check if autofilter is activated on a sheet or not to subsequently activate it when it's not.

is there a way to check this?
tried:
if selection.autofilter = false then selection.autofilter

but ofcourse that didn't work :-s
must be something simple but I can't figure it out.

thnx for the help
 
Doesn't matter if autofilter is already active or not, you may call the Range.AutoFilter method with the field(s) and criteria(s) arguments even if it's already active.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
....but to answer the question, the property you are looking for is the autofiltermode property

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
xlbo is correct. You can use the autofiltermode property to test for the filter pulldowns are present.

Filtermode property is also available. It allows you to test whether the worksheet contains a filtered list in which there are hidden rows.
 
thnx PHV but with range.autofilter you need to give criteria right away and although a tip worth while this time I needed to check if autofilter was present for enduser purposes not to filter.

Although I trie to be as clear as possible when I state a problem, I don't always succeed by lack of knowledge. Maybe that applies here also. :-$

Geoff, thank you, as always you are right on it.
:)

anyway thanks guys for all your efforts
it is very much appreciated
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top