toolbar button

D

Dennis S.

I've added a button on the toolbar to turn on Autofilter. How can I add
another button to turn Autofilter off?
 
F

FSt1

hi
Basically the same way you add the button to turn it off. Auto filter is
boolean. the same command that turns it on also (if on) turns it off.

regards
FSt1
 
D

Dave Peterson

There's a button that you can add (Show All) that shows all the hidden rows.

But I've never seen a built-in button that actually removes the arrows from the
header rows.

If you don't have any event macros running that kills undo, you may want to try
this.

Select the row with the headers.
hit the delete key on the keyboard
(It clears the contents and removes the arrows)
then hit ctrl-z (edit|Undo) to put the data back.
 
B

Bob Flanagan

Dennis, take a look at the Filter Assistant at
http://www.add-ins.com/filtasst.htm. It will toggle filteringoff on a
column if it is filtered. If you select a cell on the top filtered row, and
the column is not filtered, it unfilters the worksheet.

Bob Flanagan
Macro Systems
144 Dewberry Drive
Hockessin, Delaware, U.S. 19707

Phone: 302-234-9857, cell 302-584-1771
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 
R

Roger Govier

Hi Dennis

I got fed up with this being a one way operation also.
I added this macro to my Personal.xls

Sub AutoFiltOnOff()

Dim actCell As Range
Set actCell = ActiveCell
Application.ScreenUpdating = False
On Error Resume Next
Rows(ActiveCell.Row).Select
Selection.AutoFilter
actCell.Select
On Error GoTo 0
Application.ScreenUpdating = True

End Sub

Then whilst in Customise mode on the Toolbar, utilising the same icon
for the Autofilter,
right click>Assign Macro>Personal.xls!AutoFiltOnOff

The on error resume next is in case you click the button on a row with
no data, which would cause Autofilter to throw an error.
Setting actCell at the beginning, and selecting it at the end, prevents
an entire row selection, if the Resume Next has been invoked.

This quite happily toggles the Autofilter on and off for me.
 
J

JICDB

I know that this has been answered loooong time ago but I read through it
for my problem and I ended up with a different solution.

I wanted the button to appear on the document itself for users who have no
idea how to use Excel. I recorded a macro which had me select the title row,
go to data then filter than autofilter (which turned the filter on) and then
selected the first cell of my data and turned the recorder off. I then
attached this macro to a button which I placed on the document. I only
needed one macro as running the macro again toggled the check mark to off.
Everytime the button is selected the filter turns off and on.

The purpose for this was for users who can't remember what they filtered on
to get back all of the records without having to use the toolbars. (I know
the arrow turns blue but they wanted something pretty foolproof)
 
Top