Hi there, I am trying to create a hyperlink to each line of a list of titles that are produced through a While loop.
The below code works fine, but does not allow for the Anchor and SubAddress to be adjusted with each iteration of the loop.
ActiveSheet.Hyperlinks.Add Anchor:=Cells(3, 2), Address:="", SubAddress:= _
"Sheet1!A570", TextToDisplay:="DD"
Here is the full code that I am trying to get be able to follow with the loop
Dim LabelStart As Integer
Dim LabelOffset As Integer
Dim LabelName As String
Dim ListNum As Integer
LabelStart = 2
ListNum = 2
LabelName = Sheets("Model").Cells(ActiveCell.Row, 5) 'LabelName is edited for each iteration in a step not shown here
Sheets("Charts").Activate
LabelOffset = LabelStart + 26
ActiveSheet.Hyperlinks.Add Anchor:=Cells(LabelStart, 1), Address:="", _
SubAddress:=Cells(LabelOffset,1) _
TextToDisplay:=LabelName
'To Increase for next iteration of loop
LabelStart = LabelStart + 27
ListNum = ListNum + 1
I also get a 'Compile Error' for the TextToDisplay line and I can't figure out how fix it. Any help would be greatly appreciated!
The below code works fine, but does not allow for the Anchor and SubAddress to be adjusted with each iteration of the loop.
ActiveSheet.Hyperlinks.Add Anchor:=Cells(3, 2), Address:="", SubAddress:= _
"Sheet1!A570", TextToDisplay:="DD"
Here is the full code that I am trying to get be able to follow with the loop
Dim LabelStart As Integer
Dim LabelOffset As Integer
Dim LabelName As String
Dim ListNum As Integer
LabelStart = 2
ListNum = 2
LabelName = Sheets("Model").Cells(ActiveCell.Row, 5) 'LabelName is edited for each iteration in a step not shown here
Sheets("Charts").Activate
LabelOffset = LabelStart + 26
ActiveSheet.Hyperlinks.Add Anchor:=Cells(LabelStart, 1), Address:="", _
SubAddress:=Cells(LabelOffset,1) _
TextToDisplay:=LabelName
'To Increase for next iteration of loop
LabelStart = LabelStart + 27
ListNum = ListNum + 1
I also get a 'Compile Error' for the TextToDisplay line and I can't figure out how fix it. Any help would be greatly appreciated!