I have an Excel workbook with two sheets, basically a one-to-many setup between the two sheets. The first sheet lists several hundred companies and the second sheet lists
You can accomplish this by doing something this in the worksheet module:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Update Table14 to your table name
'Update Field to column number of the field you are filtering
'Update Sheet7 to reference the sheet containing your table
'Change on to the column number where your click should cause this action
If ActiveCell.Column = 1 Then
Sheet7.ListObjects("Table14").Range.AutoFilter Field:=1, Criteria1:=ActiveCell.Value
'Update Sheet7 to reference the sheet containing your table
Sheet7.Activate
End If
End Sub
You'll need to open the visual basic editor, right click the company worksheet, view code, paste this in:
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim CompanyName As String
If Selection.Count = 1 Then
If Not Intersect(Target, Range("C1").EntireColumn) Is Nothing Then
'This code is triggered when any
'ONE cell in column C is selected
'Simply change "C1" to "B1" etc etc
'This MsgBox returns the selected cell
MsgBox Target.Address
'You'll probably need to collect some information
'in this section. You can then use this to affect
'the filters on sheet 2.
'Perhaps like this
CompanyName = Cells(Target.Row, 1).Value
MsgBox CompanyName
'This changes to "Sheet2"
Sheets("Sheet2").Activate
End If
End If
End Sub
Hope that helps and you can make something of it