Forum Discussion
Hyperlink and view the cell in different workbooks
Hyperlink can only jump to a cell address, not search for a value.
Macros can search for the value and jump to the correct cell.
If using VBA, place the code in the sheet module, update the file path, and save as .xlsb. and double click on value
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim val As Variant
Dim wb As Workbook
Dim ws As Worksheet
Dim c As Range
' Only run if the double-clicked cell contains a number
If IsNumeric(Target.Value) Then
val = Target.Value
Cancel = True ' Prevent Excel from entering edit mode
' Open Test 2 workbook (update path if needed)
Set wb = Workbooks.Open("your File path\Test 2.xlsx")
Set ws = wb.Sheets("Sheet1") ' Change sheet name if required
' Search for the value
Set c = ws.Cells.Find(What:=val, LookIn:=xlValues, LookAt:=xlWhole)
If Not c Is Nothing Then
c.Select
Else
MsgBox "Value " & val & " not found in Test 2.", vbInformation
End If
End If
End Sub
If using hyperlink, define the named range “Values2” in both workbooks, but note that hyperlink still refers to the cell address, not the value and both files should be in same folder.
=HYPERLINK("[Test 2.xlsx]Sheet1!" & ADDRESS(MATCH(B1,Values2,0), COLUMN(Values2)), "Go to match")