I have a workbook that has either autofilters or advanced filters in it and a button called "Show All" that I would like to show all the data and remove the autofilter. My code (below) doesn't have an error catch if there is no filter when they click on the button and if it's an autofilter, it shows all but doesn't remove the autofilter (I have to click on the button twice). Here's my code;
Private Sub CommandButton2_Click()
'Show all (Remove filters)
If ActiveSheet.FilterMode Then
ActiveSheet.ShowAllData
Exit Sub
End If
Selection.AutoFilter
Range("A5").Select 'to position active cell
End Sub
I'm working in Excel 2000. Thanks in advance.
Bookmarks