VBA Macro to create internal hyperlink

Shiremaid

Board Regular
Joined
Jun 18, 2013
Messages
73
I have a workbook with a template page that gets copied for each new country we add to a project.
There are hyperlinks that lead to places within the page (go to bottom, go to top).
I successfully created a macro to copy the template page and add it to the reports, but users still have to manually redirect the hyperlinks to the new page instead of them trying to take you back to the template page. Is there any way to use VBA to redirect the hyperlinks or is there a better way to let users move around within a worksheet?
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
See if this example helps:

Code:
Sub HL_Example()
Dim ws As Worksheet, h As Hyperlink
Set ws = ActiveSheet
[d75].Activate
ws.Hyperlinks.Add Selection, "", "Sheet1!C8", "Tip", "MyName"   ' new link
ws.Hyperlinks(2).Follow False, True                             ' follow link
For i = 1 To ws.Hyperlinks.count                                ' display properties
    Set h = ws.Hyperlinks(i)
    MsgBox h.SubAddress & vbLf & h.Name & vbLf & h.Range.Address
Next
ws.Hyperlinks("MyName").SubAddress = "Shops!D4"                 ' change existing link
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top