Hi! I'm creating a hyperlink to make it easier to navigate the spreadsheet. With the active cell, I want to hyperlink this to a cell in the 8th row with the same value as the active cell.
Can someone explain to me why this doesn''t work:
Sub FindSelection()
Dim rngFound As Range
wsn = ActiveSheet.Name
With Range(Cells(8, 1), Cells(8, Columns.Count))
Set rngFound = .Find(What:=ActiveCell.Value, LookAt:=xlPart, LookIn:=xlValues, SearchDirection:=xlNext, After:=.Cells(.Cells.Count), MatchCase:=False)
ActiveCell.Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
"'" & wsn & "'" & "rngFound", TextToDisplay:=ActiveCell.Value
End With
End Sub
The "rngFound" before 'texttodisplay' is what doesn't work.
Can someone explain to me why this doesn''t work:
Sub FindSelection()
Dim rngFound As Range
wsn = ActiveSheet.Name
With Range(Cells(8, 1), Cells(8, Columns.Count))
Set rngFound = .Find(What:=ActiveCell.Value, LookAt:=xlPart, LookIn:=xlValues, SearchDirection:=xlNext, After:=.Cells(.Cells.Count), MatchCase:=False)
ActiveCell.Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
"'" & wsn & "'" & "rngFound", TextToDisplay:=ActiveCell.Value
End With
End Sub
The "rngFound" before 'texttodisplay' is what doesn't work.