Automatically setting filters based upon user selection criteria

JC500

New Member
Joined
Mar 13, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi,

Note: I'm not a VB expert or even a beginner, so I may get the wording wrong so apologies and thanks in advance:

Background:
I have 2 x sheets, called:
• Master: This is a front menu page that all users see that contains an image (4 Pillars) as per the example:
1710338046811.png

• Each Pillar is associated within a different cell and name i.e.,
B11 = Business, D11 = Capability, F11 = Invocation & G11 = Testing
• Standards: This sheet contains a list of rows that are filtered primarily by the Pillar type:
1710338626213.png

• Each pillar could contain 1 or more rows. Each row contains additional information i.e. Policy id, Area, policy statement and guidelines

Note: I can associate each pillars in the Master sheet to the "Standards" sheet using the Link feature based upon the following defined names e.g., Business, Capability, Invocation etc. However, this feature does not automatically filter the data so that is shows only the selected pillar the user has selected; in fact it show the current pillar as well as the remaining pillars.

The Ask:
When the user selects one of the Pillars from the Master sheet e.g., D11 = Capability can the "Standards" sheet be automatically filtered so that only the the relevant selection is shown i.e., Capability?
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
• Each Pillar is associated within a different cell and name i.e.,
B11 = Business, D11 = Capability, F11 = Invocation & G11 = Testing

Does that mean the Business pillar image has the name Business in the Name Box? And the Capability pillar image has the name Capability, etc.

If so, this simple solution should fit your setup.

Add the following code in a standard module:

VBA Code:
Public Sub Pillar_Click()
    
    If Not IsError(Application.Caller) Then
        With ThisWorkbook.Worksheets("Standards")
            .Activate
            .Range("A1").CurrentRegion.AutoFilter Field:=1, Criteria1:=Application.Caller
        End With
    Else
        MsgBox "Pillar_Click can only be called by clicking one of the pillars", vbExclamation
    End If
    
End Sub
Next, assign the Pillar_Click macro to each of the 4 pillar images.

Now click one of the pillars and it should activate the Standards sheet and filter column A by the clicked pillar.

NB - it looks like you have merged cells in the Pillars column. Autofilter doesn't display all rows when merged cells are filtered - you must have a value in every cell in column A.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,954
Members
449,096
Latest member
Anshu121

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