Your procedures for using code seem to be fine. I tested the code in
XL2003 and XL2007. What version are you using? Also, the code works
only with Hyperlinks created via the Insert menu. It will not work
with hyperlinks that are created with the HYPERLINK worksheet function
-- clicking on a link created with the HYPERLINK worksheet function
doesn't raise an event so there is no way to unhide the sheet.
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
On Sat, 12 Sep 2009 23:43:01 -0700, stew
wrote:
Hi Chip
Right clip on the tab
then I assume View code
Then paste in Macro
Is there anything else I need to do
I did that on my Hyperlink sheet and then hid two of my sheets and tried to
accesss them with the hyperlinks. No go. Unhide them, all ok
I am not very familiar with macros but you have the Gist of what I want to
achieve.
What am I missing
Best
Stew
"Chip Pearson" wrote:
You need to use some code to make the target worksheet visible and the
call the hyperlink a second time. Right-click the tab of the worksheet
than contains the hyperlink (not the sheet to which the hyperlink
refers), and paste in the following code:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim WB As Workbook
Dim WSName As String
Dim WS As Worksheet
Dim N As Long
With Target
If .Address = vbNullString Then
Set WB = ThisWorkbook
Else
Set WB = Workbooks(.Address)
End If
N = InStr(1, .SubAddress, "!")
WSName = Replace(Left(.SubAddress, N - 1), "'", vbNullString)
Set WS = WB.Worksheets(WSName)
If WS.Visible < xlSheetVisible Then
Application.EnableEvents = False
WS.Visible = xlSheetVisible
Target.Follow
Application.EnableEvents = True
End If
End With
End Sub
If the worksheet to which the hyperlink refers is hidden, the code
unhides the worksheet and then calls the hyperlink's Follow method to
go to the link on the now-visible worksheet.
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
On Sat, 12 Sep 2009 06:36:01 -0700, stew
wrote:
Hi all
Is it possible to have Hyperlinks on one worksheet to access Hidden
Worksheets on the same work book
Thanks for looking
Stew