stuartgb100
Active Member
- Joined
- May 10, 2015
- Messages
- 322
- Office Version
- 2021
- Platform
- Windows
The following code snippet works well:
Sheets("Index").Range("B2").Hyperlinks.Add _
Anchor:=Sheets("Index").Range("B2"), Address:="", _
SubAddress:="'Artists 1'!B2", _
TextToDisplay:=Sheets("Artists 1").Range("B2").Value
However, when I try to use variables, it does not work:
Sheets("Index").Range("B" & TargetRw).Hyperlinks.Add _
Anchor:=Sheets("Index").Range("B" & TargetRw), Address:="", _
SubAddress:="'" & SourceSht.Name & "'" & .Range("B" & StartRw), _
TextToDisplay:=Sheets(SourceSht).Range("B" & StartRw).Value
I think there's a Type Mismatch in the last but 1 line.
Any help would be much appreciated.
Thanks.
Sheets("Index").Range("B2").Hyperlinks.Add _
Anchor:=Sheets("Index").Range("B2"), Address:="", _
SubAddress:="'Artists 1'!B2", _
TextToDisplay:=Sheets("Artists 1").Range("B2").Value
However, when I try to use variables, it does not work:
Sheets("Index").Range("B" & TargetRw).Hyperlinks.Add _
Anchor:=Sheets("Index").Range("B" & TargetRw), Address:="", _
SubAddress:="'" & SourceSht.Name & "'" & .Range("B" & StartRw), _
TextToDisplay:=Sheets(SourceSht).Range("B" & StartRw).Value
I think there's a Type Mismatch in the last but 1 line.
Any help would be much appreciated.
Thanks.