Have a workbook name Test.
On Sheet1 Cells B2:B50 have hyperlinks in them to other locations within the workbook. The Hyperlink cells have formulas such as:
=HYPERLINK("#"&"Sheet4!$Z$5",Sheet4!$Z$2)
Z2 on Sheet4 will have Text or a number. This is an example of a value that is searched for in the range B2:B5 on Sheet1. Z2 in this Case is Delaware, another is California, another is 92506
In a nut shell.
Use input box to search Sheet 1 Range B2:B50, if value is located in range activate the hyperlink in that cell to navigate to the location desired.
Code works to the last line, Activate.Hyperlink. Hyperlink does not activate. Not sure I have this stated correctly.
This is what I have so far:
Sub Search_Navigate()
'
' Search_Navigate Macro
'
'
Dim strFind As String
Dim rFound As Range
Dim lReply As Long
Sheets("Sheet1").Select
Columns("B:B").Select
strFind = InputBox("Find Location or Location Code?", "FIND IT")
If strFind = vbNullString Then Exit Sub
With ActiveSheet
If WorksheetFunction.CountIf(.UsedRange, strFind) = 0 Then
MsgBox strFind & " cannot be found on this sheet"
Else
Set rFound = .UsedRange.Find(strFind, .Cells(1, 1), xlValues, xlWhole, , , False)
lReply = MsgBox(strFind & " is in cell " & rFound.Address & " Click ok To Navigate", vbOKCancel + vbQuestion)
If lReply = vbOK Then Application.Goto rFound, True
rFound.Activate
Activate.Hyperlink
End If
End With
End Sub
On Sheet1 Cells B2:B50 have hyperlinks in them to other locations within the workbook. The Hyperlink cells have formulas such as:
=HYPERLINK("#"&"Sheet4!$Z$5",Sheet4!$Z$2)
Z2 on Sheet4 will have Text or a number. This is an example of a value that is searched for in the range B2:B5 on Sheet1. Z2 in this Case is Delaware, another is California, another is 92506
In a nut shell.
Use input box to search Sheet 1 Range B2:B50, if value is located in range activate the hyperlink in that cell to navigate to the location desired.
Code works to the last line, Activate.Hyperlink. Hyperlink does not activate. Not sure I have this stated correctly.
This is what I have so far:
Sub Search_Navigate()
'
' Search_Navigate Macro
'
'
Dim strFind As String
Dim rFound As Range
Dim lReply As Long
Sheets("Sheet1").Select
Columns("B:B").Select
strFind = InputBox("Find Location or Location Code?", "FIND IT")
If strFind = vbNullString Then Exit Sub
With ActiveSheet
If WorksheetFunction.CountIf(.UsedRange, strFind) = 0 Then
MsgBox strFind & " cannot be found on this sheet"
Else
Set rFound = .UsedRange.Find(strFind, .Cells(1, 1), xlValues, xlWhole, , , False)
lReply = MsgBox(strFind & " is in cell " & rFound.Address & " Click ok To Navigate", vbOKCancel + vbQuestion)
If lReply = vbOK Then Application.Goto rFound, True
rFound.Activate
Activate.Hyperlink
End If
End With
End Sub