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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding/removing auto filter 1

Status
Not open for further replies.

maclav

Programmer
Oct 29, 2007
28
GB
Hi
I am quite experienced with using vb to make excel do what i want but have come up against a peculiarity i was hoping some one could clear up.
It look to me like the code that adds an auto filter to a selection is also the same as the code to get rid of it.
Is there some code I could put in an if to say:
if auto filter is there then run the code
and visa versa depending on the situation
Thanks for any help
 
For Range object AutoFilter method (without parameters)toggles the autofilter. For Worksheet object returns AutoFilter object. To test:
MsgBox Not ActiveSheet.AutoFilter Is Nothing


combo
 
Brilliant. That did what i needed.
Thanks
 
A simpler approach:
MsgBox ActiveSheet.AutoFilterMode

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top