View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Hyperlink to Hidden sheet

Jeff,

XL 97 does not have a FollowHyperlink event.
XL 2002 does. XL2000 ?

However the code would not work in XL 2002 until the single quote
marks "'" around the sheet name were removed.
The following worked for me on hidden sheets...
'--------------------------------------------
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim strAddress As String

strAddress = _
Application.Substitute(Target.SubAddress, "'", vbNullString)
Worksheets(Left$(strAddress, _
InStr(1, strAddress, "!") - 1)).Visible = xlSheetVisible
Application.EnableEvents = False
Target.Follow
Application.EnableEvents = True

End Sub
'--------------------------------------------

Regards,
Jim Cone
San Francisco, CA

"muziq2 " wrote in message ...
Hi all,
I need to hyperlink to a hidden sheet inside the same workbook. My
hyperlink format is
=HYPERLINK("[filename]'sheetname'!A1","friendlyname")
The exact hyperlink is below.
=HYPERLINK("[0304HireTerm.xls]'Job Elimination'!A1","Job elimination")
The hyperlink function only works when the sheet is not hidden.
Someone provided me with the code below saying that it will open the
hidden sheet however I can't get it to work. Any other suggestions.
There are about 5 sheets that I want hidden until someone clicks on a
link to the sheet for more background detail.
Thanks,
Jeff


"Put this code in the worksheet module that has the hyperlink(s).
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Worksheets(Left(Target.SubAddress, InStr(1, Target.SubAddress, "!") -
1)).Visible = xlSheetVisible
Application.EnableEvents = False
Target.Follow
Application.EnableEvents = True
End Sub