Macro to add sheet name and hyperlink to list

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
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
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
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
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,266
Members
448,558
Latest member
aivin

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