How to double click on a cell and go to another sheet filtering the data

gigix89

New Member
Joined
Apr 28, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi Guys

I would need your help. I have one file excel with two sheets. One are the orders to be shipped and the other one is the inventory. Both sheets are extraction from an ERP system

I would like to write a macro that with a double click on an ID product in the sheet "orders to be shipped" goes in the other sheet "inventory" filtering the data.

Can you help me?

thanks
Luigi
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
You haven't given any details as to what columns you need. So I assumed a list on sheet1 for the list to click and I assumed the data was in sheet2 colums C and D to filter.
put this code in the sheet1 code :
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
filv = Target.Value
Call filt(filv)
End Sub
and put this code in a standard module:
VBA Code:
Sub filt(fval As Variant)
    Worksheets("Sheet2").Select
    Columns("C:C").Select
    Selection.AutoFilter
    ActiveSheet.Range("$C$2:$D$34").AutoFilter Field:=1, Criteria1:=fval

End Sub
Adjust fitler etc to your requirements
 
Upvote 0
Hi @offthelip thanks for your reply.

here the sheet one, where you see the Cd_AR, which is the product that I am going to double click.

1619611947047.png


while here the sheet to that I want to be filtered in automatically

1619612013996.png
 
Upvote 0
How about
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
   If Target.Column = 8 Then
      Cancel = True
      With Sheets("OC_vs_Giancenza")
         .Range("A1").AutoFilter 1, Target.Value
         Application.Goto .Range("A1"), True
      End With
   End If
End Sub
This needs to go in the sheet module where you want to double-click
 
Upvote 0
Solution
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,624
Messages
6,120,591
Members
448,973
Latest member
ksonnia

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