I have a workbook with a list of names in Sheet 1, Col A.
I also have a macro that creates and names a new sheet for every name. That is working well.
Then I have this macro that creates a hyperlink from the name to the sheet. It also works well but pops an error message after it runs.
Run-time error '5':
Invalid procedure call or argument
The debugger highlights lines 4 and 5.
Here is the code:
Sub AddHyperlink()
Dim i As Long
With Sheets("Sheet1")
For i = 1 To .Range("A" & .Rows.Count).End(xlUp).Row
.Hyperlinks.Add Anchor:=.Range("A" & i), Address:="", _
SubAddress:="'" & .Range("A" & i).Value & "'!A1", TextToDisplay:=.Range("A" & i).Value
Next i
End With
End Sub
This is some code I found online but I don't completely understand it.
Thanks for all your help so far with this project.
Len Silva
Bookmarks