ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro does not sheet name (https://www.excelbanter.com/excel-programming/301878-re-macro-does-not-sheet-name.html)

Marcotte A

macro does not sheet name
 
"Todd" wrote:

Hi,


Range("C7").Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
"'12010'!A61", TextToDisplay:="January"


Never worked with hyperlinks, but I think what you want to do is change SubAddress to:

SubAddress:= "'' & activesheet.name & "'A61"

not 100% sure of the syntax, but if VBA acts like the INDIRECT function, this should work.

Marcotte A

macro does not sheet name
 
Actually, it should be this:

SubAddress:=ActiveSheet.Name & "!A61"

Todd

macro does not sheet name
 
Thank you! The second way is working.

"Marcotte A" wrote:

Actually, it should be this:

SubAddress:=ActiveSheet.Name & "!A61"



All times are GMT +1. The time now is 04:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com