Text Box to set filters

WendyHubard

New Member
Joined
Apr 4, 2017
Messages
39
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello Wizards,

I'm trying to use a text box disguised as button to set the filters. Have attached a sample. I'm trying to avoid using macros/vba if possible as my workplace has everything locked down
Many thanks in advance

Sample.xlsx
H
6
Sheet1


1740905523490.png
 
Seems your data is in excel table.
If you don't want to use VBA, a good idea will be to use slicer.

Active cell inside a table and Insert->Filters-> Slicer

The slicer (marked with asterisk ona a screenshot allows you to filter with several categories switched on and off) - a sample is from other file as your XL2BB shows no data.

1740906406424.png
 
Upvote 0
Solution
1) To a standard code modue.
Code:
Sub FilterTable()
    Dim s$
    With ActiveSheet
        s = .Shapes(Application.Caller).TextFrame.Characters.Text
        With .ListObjects(1)
            If .ShowAutoFilter Then
                If .AutoFilter.FilterMode Then .AutoFilter.ShowAllData
            End If
            .Range.AutoFilter 3, s
        End With
    End With
End Sub
2) Assign above to the buttons.
 
Upvote 0
Thank you both for your replies. I'm liking the Slicer option as it's quick and easy. Just wondered how to hide empty rows? I've set the Slicer to Hide items with no data, but how do I remove the button "(Blank)".

Again. thanks in advance

1740911911170.png


Sample.xlsx
ABCDEFGHIJK
1
2
3
4
5
6DatePersonStatusDueDue StatusDescription
71/02/1935Blogg, PeterComplete1/06/2025OtherGardening
82/02/1935Smith, jonesUnder Investigation5/03/2025Due in 7 DaysRoad works
93/02/1935Blogg, DannyComplete1/04/2025OtherSleep outs
104/02/1935Fish, PeterUnder Investigation30/03/2025OtherRoofing
115/02/1935Brett, JamesComplete1/02/2025Over DueGardening
126/02/1935Noddy, SlevUnder Investigation1/01/2025Over DueRoad works
137/02/1935Blogg, PeterComplete Sleep outs
148/02/1935Smith, jonesUnder Investigation Roofing
159/02/1935Blogg, DannyComplete1/10/2024Over DueGardening
1610/02/1935Fish, PeterUnder Investigation1/09/2024Over DueRoad works
1711/02/1935Brett, JamesComplete1/08/2024Over DueSleep outs
1812/02/1935Noddy, SlevUnder Investigation1/07/2024Over DueRoofing
191/02/1935Blogg, PeterComplete1/06/2024Over DueGardening
Sheet1
Cell Formulas
RangeFormula
E7:E19E7=IFS([@Due]="","",[@Due] <TODAY(),"Over Due",AND([@Due] >=TODAY(), [@Due]<=(TODAY()+7)),"Due in 7 Days",[@Due]<=(TODAY()>8),"Other")
 
Upvote 0
Sorry to say so, but I don't know how to get rid of these extra filters for blanks.
 
Upvote 0

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