Double click and jump to another sheet with the same data

feni1388

Board Regular
Joined
Feb 19, 2018
Messages
61
Office Version
  1. 2021
Platform
  1. Windows
Hello..

I need help with macro code.
I have several sheets but the main Master sheet is where everyone put data to check the result.
So within Range D6 to D21, anyone can enter item code.
I want to make it when someone enter an item code and double click it, it will jump to another sheet that has the same item code with its information.

Please help...

Thank you
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
it will jump to another sheet that has the same item code with its information.
How would we know which sheet that is? Is the item code entered in the Master sheet the name of the sheet that it should jump to?

BTW, I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
Thanks for the reply.
I just updated my account details.

Sorry for the lack of information.
Let's say I have "Master" sheet and "Item" sheet.
In the item sheet on column A I have a list of items' code (around 500 items) and column B, C and so on will have each item's size, weight etc

when someone enter item code GL43 in Master sheet (anywhere between D6 and D21) and double click it, it will jump to "Item" sheet column A where GL43 is located so they can check GL43 weight, size, etc

I hope it's clear. Please let me know if there's something I'm missing.
 
Upvote 0
Ah, thanks. I had thought there were more sheets than that. 😎

Try this in the 'Master' worksheet's module

VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
  Dim rFound As Range
  
  If Not Intersect(Target, Range("D6:D21")) Is Nothing Then
    If Len(Target.Value) > 0 Then
      Cancel = True
      Set rFound = Sheets("Item").Columns("A").Find(What:=Target.Value, LookAt:=xlWhole)
      If rFound Is Nothing Then
        MsgBox Target.Value & " not found"
      Else
        Application.Goto Reference:=rFound, Scroll:=True
      End If
    End If
  End If
End Sub
 
Upvote 0
You're welcome. Thanks for the follow-up. :)
 
Upvote 0
Sorry Peter....
One more thing, if it's possible.
Instead of just jumping to Column A where the item is located, is it possible to highlight the whole row?
As we have a long list, I'm just worried that we're looking at the wrong row.

Thank you in advance
 
Upvote 0
Instead of just jumping to Column A where the item is located, is it possible to highlight the whole row?
:unsure: I'm wondering why that is needed? The code provided jumps to the correct row and moves that row to the very top of the screen so the relevant row should be very easy to identify and follow across.

If the row is to be highlighted ..
  1. When should it become un-highlighted (so in future there are not 2, 3 or more rows all highlighted)?
  2. Is there anything on the 'Item' sheet that already has colour applied (Manually, by conditional formatting or by other code)?
 
Upvote 0
Sorry, perhaps I'm not saying it correctly.
What I meant is not highlight with color, but highlight just like when you click on the whole row.
 
Upvote 0
OK, I misinterpreted your request. 😎

Try this change

Rich (BB code):
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
  Dim rFound As Range
  
  If Not Intersect(Target, Range("D6:D21")) Is Nothing Then
    If Len(Target.Value) > 0 Then
      Cancel = True
      Set rFound = Sheets("Item").Columns("A").Find(What:=Target.Value, LookAt:=xlWhole)
      If rFound Is Nothing Then
        MsgBox Target.Value & " not found"
      Else
        Application.Goto Reference:=rFound, Scroll:=True
        rFound.EntireRow.Select
      End If
    End If
  End If
End Sub
 
Upvote 1
Solution

Forum statistics

Threads
1,215,071
Messages
6,122,964
Members
449,094
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