![]() |
Create a HYPERLINK with a macro?
Can anyone tell me how to create a hyperlink to a different sheet with a
macro? The sheet will always be the third tab when the macro runs but may change locate subsequently so the hyperlink must refer to the sheet name. I appreciate your help. --- Message posted from http://www.ExcelForum.com/ |
Create a HYPERLINK with a macro?
This formula should do what you want.
=HYPERLINK("[Yourworksheet.xls]yourworksheet!a1") But, I prefer to use a double click event macro to do this right click sheet tabview codeinsert this Then just double click on the cell with a typed name of the sheet desired. Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Dim mysheet As String mysheet = Trim(ActiveCell.Value) On Error GoTo no Sheets(mysheet).Select Exit Sub no: MsgBox "No Sheet" End Sub -- Don Guillett SalesAid Software "bobgerman" wrote in message ... Can anyone tell me how to create a hyperlink to a different sheet with a macro? The sheet will always be the third tab when the macro runs but may change locate subsequently so the hyperlink must refer to the sheet name. I appreciate your help. --- Message posted from http://www.ExcelForum.com/ |
Create a HYPERLINK with a macro?
Sheets("Index").Select
Range("A5").Select Dim mycel As String mycel = (ActiveCell.Value) ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _ mycel & "!A1:B1" Using info originally obtained from Don...Thanks Don! --- Message posted from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 08:34 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com