auto filter

kac1125

Board Regular
Joined
Jul 31, 2014
Messages
74
Office Version
  1. 365
Platform
  1. Windows
Hello, I have an auto filter where if I double click on a value in column A worksheet on it filters coulmn A on worksheet 2
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column = 1 Then
Cancel = True
With Sheets("Sheet2")
.Range("A1").AutoFilter 1, Target.Value
Application.Goto .Range("A1"), True
End With
End If
End Sub

I want it to also apply the same filter to worksheet 3 column A at the same time. Please let me know the best way to accomplish this.

thank you in advance!
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Try this:

VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
  If Target.Column = 1 Then
    Cancel = True
    With Sheets("Sheet2")
      .Range("A1").AutoFilter 1, Target.Value
      Application.Goto .Range("A1"), True
    End With
    With Sheets("Sheet3")
      .Range("A1").AutoFilter 1, Target.Value
    End With
  End If
End Sub
 
Upvote 0
Try this:

VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
  If Target.Column = 1 Then
    Cancel = True
    With Sheets("Sheet2")
      .Range("A1").AutoFilter 1, Target.Value
      Application.Goto .Range("A1"), True
    End With
    With Sheets("Sheet3")
      .Range("A1").AutoFilter 1, Target.Value
    End With
  End If
End Sub
Great!!! Worked perfect! appreciate it!!
 
Upvote 0

Forum statistics

Threads
1,215,221
Messages
6,123,701
Members
449,117
Latest member
Aaagu

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