Macro to add sheet name and hyperlink to list

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
2,679
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,

I was hoping i could get a macro to do the following when run

Take the name of the active sheet,
in sheet "Welcome" Column Q Place it under the last name already there and add a hyperlink in the cell next to the name that says click to view and takes you to the sheet when clicked.

thanks

Tony
 

Some videos you may like

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

offthelip

Well-known Member
Joined
Dec 23, 2017
Messages
1,658
Office Version
  1. 2010
Platform
  1. Windows
try this code:
VBA Code:
Sub addlink()
Dim subadd As String
WsName = ActiveSheet.Name
With Worksheets("Welcome")
 lastrow = .Cells(Rows.Count, "A").End(xlUp).Row + 1
 Range(.Cells(lastrow, 1), .Cells(lastrow, 1)) = WsName
 subadd = WsName & "!A1"
 .Hyperlinks.Add Anchor:=Range(.Cells(lastrow, 2), .Cells(lastrow, 2)), Address:="", SubAddress:= _
        subadd, TextToDisplay:="Click to View"
End With
End Sub
 

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
2,679
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Off the lip,
this is great, thank you for your help
Tony
 

Watch MrExcel Video

Forum statistics

Threads
1,122,991
Messages
5,599,242
Members
414,298
Latest member
bongielondy

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
Top