Dynamically paste hyperlink to another sheet

annasmiz

New Member
Joined
Jul 20, 2019
Messages
1
Hello,
I have a macro that currently pastes text and charts to a Dashboard sheet from several other pre-formatted sheets. The pre-formatted sheets are copied and renamed by another macro, when the user wants to create a new sheet of one of the 5 template types we have in this tool. I would like to create easy navigation from the Dashboard sheet to the other sheets. My major problem is that they need to be able to navigate to sheets that have not yet been created or named. My solution is to include in the copy/paste macro some lines that get excel to paste a hyperlink to the template sheet on the Dashboard next to the visuals. However, I have had trouble getting the syntax down or finding relevant examples to help me through this.

I probably need to define a variable that is the last active sheet, and have that as the Address, the address must be a string. (referred to below as "Lstsheet")

I likely need to define a variable, which is the name of the last active sheet, and have that as the TextToDisplay (referred to below as "Lstname")

I need help defining the variables correctly and getting the syntax of this line correctly.
Here's where I've gotten:

At this point, the macro will have gone back and forth between last open sheet and the dashboard copy and pasting several things and will be open to the dashboard.

Code:
ActiveSheet.Hyperlinks.Add(Anchor:= "Dashboard!A15",_ Address:=Lstsheet,_ ScreenTip:= "Click here to view more or edit.",_ TextToDiplay:=Lstname)
[\code]

Thanks in advance for your time. 

Best,
Anna
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,214,614
Messages
6,120,519
Members
448,968
Latest member
Ajax40

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