Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / November 2007

Tip: Looking for answers? Try searching our database.

Filter: Macro/CommandButton - Show filtered data-Show all

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Snoopy - 28 Nov 2007 08:52 GMT
Hey Guys

I intend my macro to do this:
If autofilter is activated then show all, if not then activate
autofilter .

- a kind of on/off autofiler-button based on some "spagetti"-
programming of mine:

Selection.AutoFilter Field:=7, Criteria1:="MTO OK"
ActiveSheet.ShowAllData

... but I struggle to make this work, and humberly ask you guys for
help.

Best Regards
Snoopy
Dave Peterson - 28 Nov 2007 12:21 GMT
With Worksheets("sheet1")
       If .FilterMode Then
          .ShowAllData
       else
          Selection.AutoFilter Field:=7, Criteria1:="MTO OK"
       End If
   End With

But I really don't like using the current selection.

Maybe...
.range("a1").currentregion.AutoFilter Field:=7, Criteria1:="MTO OK"

would be safer.

> Hey Guys
>
[quoted text clipped - 13 lines]
> Best Regards
> Snoopy

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.