Welcome toExcel.Tips.Net
Tips.Net Home
ExcelTips Home
Ask an Excel Question
Make a Comment
ExcelTips FAQ
ExcelTips Premium
Learn Access Now
Free Printable Forms
Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Legal Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Wedding Tips
Word2007 Tips
WordTips
Advertise on the
ExcelTips Site
Adding a Little Animation to Your Life
Converting a Range of URLs to Hyperlinks
Making the Formula Bar Persistent
One of the handy features of Excel is AutoFilter. It allows you to quickly filter any list by the contents of a particular column. In versions of Excel prior to Excel 2007 you can use the Customize option from the Tools menu to add an AutoFilter tool to your toolbars. This tool uses an image of a funnel and an equal sign. (In Excel 2007 you can add the same tool to the Quick Access toolbar.)
The tool is a bit deceptive, however; it is not the same as the AutoFilter option available from the Data menu or the Filter option on the Data tab of the ribbon. The menu/ribbon option is a toggle condition. If you have a cell selected in a list, and you choose the menu option, then the AutoFilter controls appear at the top of each column in the list—there are no other changes to the list. If you use the AutoFilter tool, not only do the controls appear, but Excel filters the list based on the cell you had selected when you used the tool.
Another difference between the two is that the AutoFilter menu/ribbon option functions like a toggle—choose it once, and the AutoFilter is applied; choose it again and it is removed. The AutoFilter tool doesn't do that; it only applies the AutoFilter.
What if you want a toolbar option that is a real toggle, just like the menu option? There are two approaches you can use to solve this problem. The first involves the use of a simple macro:
Sub ToggleAutoFilter()
On Error GoTo errMessage
Selection.AutoFilter
Exit Sub
errMessage:
MsgBox "Select a cell in the range to be filtered.", vbOKOnly
End Sub
All you need to do is assign the macro to a toolbar button, the Quick Access toolbar, or to a shortcut key, and you can turn AutoFilter on and off, just as if you selected the option from the menus.
The second option may be even simpler. Just follow these steps if you are using a version of Excel prior to Excel 2007:
The result is that the menu option is now accessible from the toolbar. You can click on it to turn AutoFilter on and off, at will. If you are using Excel 2007, follow these steps instead:
It is interesting that the icon for the Filter command (step 4) looks exactly the same as the icon for the AutoFilter command. Regardless, they are not the same, as already discussed. These steps add the tool to the Quick Access toolbar, and it works exactly the same as the Filter tool on the Data tab of the ribbon.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2710) applies to Microsoft Excel versions: 97 2000 2002 2003 2007
A Picture is Worth Thousands! Your worksheets are not limited to holding numbers and text. You can also add graphics or easily create charts based on your data. Excel Graphics and Charts, available in two versions, helps you make your graphics and charts their absolute best.