How to turn Autofilter off with VBA

D

Dave

Using VBA i want to make sure Autofilter is off before I run some other code.
I ran macro recorder and see that the command

Autofilter

toggles the autofilter on and off. The problem is I just want to turn it
off, so i can't use this command if the autofilter is not on or it turns it
on.

Is there some resource online or within help that describes the macro
commands and which qualifiers you can use with them (I tried "Autofilter off"
and "Autofilter False", but it gives me errors).

Can anyone tell me how to use this command to switch autofilter off.

Thanks
Dave

PS - sorry for the double post (also in general questions)
 
R

Rod Gill

Hi Dave,

John hasn't replied so he must be busy or away.

In Project 2003 the following works for me:
ActiveProject.AutoFilter = false
ActiveProject.AutoFilter = true

Otherwise try:

Sub AutoFilterOn()
If ActiveProject.AutoFilter = False Then
Application.AutoFilter
End If
End Sub

Sub AutoFilterOff()
If ActiveProject.AutoFilter = True Then
Application.AutoFilter
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top