I would like to be able to double-click on a cell within a table and have excel take me to another table where that value that I double click on is filtered so that I can see all of the values in the 2nd table for the value that I double clicked on in the first table. For example...I have a list of projects in a table column named "projects" I also have a list of projects in a 2nd table named "Region". If I double click on Project #1, I would like to see all of the values for Project #1 within my Region table. By using the following code, I can do this. However, I would now like to do this in another column within the same "projects" table. So I can either double click by column name or by Region and have it sorted in the "Region" table that is in another worksheet.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim strCellVal As String
Dim i As Long
On Error Resume Next
If Intersect(Target.EntireRow, [Projects[Region]]) Is Nothing Then Exit Sub
If Target.Cells.Count <> 1 Then Exit Sub
strCellVal = ActiveCell.Value
With Sheet3
.ListObjects(1).Range.AutoFilter 1, Criteria1:=Intersect(Target.EntireRow, [Projects[Region]])
.Activate
i = .ListObjects(1).Range.Columns(1).SpecialCells(xlCellTypeVisible).Count
If i = 1 Then
.ListObjects(1).Range.End(xlDown).Offset(1, 2).Value = strCellVal
End If
.[A1].Select
End With
Cancel = True
End Sub
How do I set this up so that I can use the double-click capability in TWO different rows, not just one?