Restore all Filtered Data

drbrow592

New Member
Joined
Mar 20, 2008
Messages
17
I have used the following UDF to allow users to Filter data, but I would like one Button to restore allData and Show "All" in Header row. Is this possible?

I do have a Button Macro that restores allData but will not Show "All" in header.

Code:
Function FilterCrit(Rng As Range) As String
Dim Filter As String
Filter = "All"
With Rng.Parent.AutoFilter
If Intersect(Rng, .Range) Is Nothing Then GoTo Finish
With .Filters(Rng.Column - .Range.Column + 1)
If Not .On Then GoTo Finish
Filter = .Criteria1
Select Case .Operator
Case xlAnd
Filter = Filter & " AND " & .Criteria2
Case xlOr
Filter = Filter & " OR " & .Criteria2
End Select
End With
End With
Finish:
FilterCrit = Filter
End Function
 
Last edited by a moderator:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
To turn all filters off, you just use Application.ShowAllData. Assuming your above code is handling the "header" display you're talking about, just have it show whatever you want. If not--I don't really know what you mean when referring to the header.
 
Upvote 0
um...you just put that line in a sub and assign the macro to a button.

It seems they changed it on me in Excel 2007, though. For 2007, you specify the sheet:
Code:
Sub ShowAll()
ActiveSheet.ShowAllData
End Sub

Again, I'm not sure what you are referring to by "header display" or even where that is, so in general: wherever you want to display the filter criteria, just write a line to put that in there. For example:
Code:
Sub ShowAll()
With ActiveSheet
    .ShowAllData
    .Range("A1") = "All"
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,692
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top