jlrobinson
New Member
- Joined
- Jul 11, 2024
- Messages
- 1
- Office Version
- 2021
- Platform
- Windows
I have a macro that takes a Template sheet and creates copies of it according to a List sheet, then populates the forms from data located in the List sheet. That part is working fine.
The issue I'm having is inserting hyperlinks from the copied sheets back to the List sheet to make navigation easier, as there are many forms to be created.
I tried using the hyperlink function as a formula, but I couldn't get that working. Other workbooks it works fine but this one throws a warning "some files contain viruses, are you sure you want to open the link" then when you say yes it throws an error "an unexpected error occurred". I've given up on that path.
Now I'm trying the vba method Hyperlink.add, and it almost works.
The code I'm using to try to add a hyperlink on cell B2 of the Copied sheet to the List sheet:
Sheets("Copied").Hyperlinks.Add Anchor:=Sheets("Copied").Range("B2"), Address:="", SubAddress:="'List'!A1", TextToDisplay:= "Link"
This code executes fine, but throws an invalid reference error when trying to follow the link.
Right clicking and editting the link shows its made the link to A1 of the Copied sheet instead of the List sheet.
The issue I'm having is inserting hyperlinks from the copied sheets back to the List sheet to make navigation easier, as there are many forms to be created.
I tried using the hyperlink function as a formula, but I couldn't get that working. Other workbooks it works fine but this one throws a warning "some files contain viruses, are you sure you want to open the link" then when you say yes it throws an error "an unexpected error occurred". I've given up on that path.
Now I'm trying the vba method Hyperlink.add, and it almost works.
The code I'm using to try to add a hyperlink on cell B2 of the Copied sheet to the List sheet:
Sheets("Copied").Hyperlinks.Add Anchor:=Sheets("Copied").Range("B2"), Address:="", SubAddress:="'List'!A1", TextToDisplay:= "Link"
This code executes fine, but throws an invalid reference error when trying to follow the link.
Right clicking and editting the link shows its made the link to A1 of the Copied sheet instead of the List sheet.