Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Open Hidden Worksheet

Hi,

I want to hyperlink to a hidden worksheet in the same workbook. An
ideas?

Everything works fine when the sheet that I want the hyperlink to jum
to is not hidden. I use the following function.

=HYPERLINK("[filename]'sheetname'!A1","display name")

When the user clicks on this cell the other sheet is displayed.

However, I want the destination sheet to be hidden until the use
clicks on the cell containing the hyperlink. Then I want the sheet t
automatically unhide and display. Then when the user clicks o
another workbook the destination sheet should then revert to hidden.

Is this possible?

Thanks,

Jef

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Open Hidden Worksheet

You need to handle two different events. 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 = xlSheetVisibl
Application.EnableEvents = Fals
Target.Follo
Application.EnableEvents = Tru
End Su

And put this code in the Worksheet module of the worksheet that you want to hide when deactivated

Private Sub Worksheet_Deactivate(
Me.Visible = xlSheetHidde
End Su

This functionality is kinda "rigged". The FollowHyperlink event is invoked twice, with the second one turned off to prevent a sort of recursion. The first pass to make the sheet visible, and the second pass to follow the hyperlink, since the first pass will not work on an invisible worksheet. Which indicates that the Follow method of the Hyperlink object is executed prior to the firing of the FollowHyperlink event. That's kinda silly, but there it is

The rigging that I put in there will not work if the sheet name you've hidden has an Exclamation point in it. If you do you have a bang in there, you'll need to make a function to return the target sheet name from the subaddress that is a little more robust than the bungle I put in there. Post back if you need help with that

I hope that helps

-Brad Vontur
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Open Hidden Worksheet

Thanks Brad. The sheets now hide automatically. However, I can't ge
the other code to work. I don't have an exclamation point in the shee
name however the link text is below and does contain an exclamatio
point.
=HYPERLINK("[0304HireTerm.xls]'VoluntaryTerm'!A1","Voluntary Term")

Will that keep the code from working? Is there a workaround.

Thanks,

Jef

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Open Hidden Worksheet

Brad was kind enough to provide the code below to hyperlink to a hidde
sheet. However it is not working. The link only works when the shee
I'm linking to is not hidden. Please help.

"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


--
Message posted from http://www.ExcelForum.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open Second Workbook Hidden? Nancy Taylor[_2_] Excel Worksheet Functions 2 September 21st 09 05:46 PM
2007 Worksheet, Hidden Columns, .CSV Format Saves Hidden Column Da Tammy Excel Discussion (Misc queries) 3 April 2nd 09 11:40 PM
Hidden Columns No Longer Hidden after Copying Worksheet? EV Nelson Excel Discussion (Misc queries) 1 December 6th 06 05:10 PM
How do I detect hidden worksheets or hidden data on a worksheet? Alice Excel Discussion (Misc queries) 4 August 24th 06 03:38 AM
Saving hidden data with a worksheet (preferably without using a hidden sheet) Dick Kusleika[_3_] Excel Programming 2 January 21st 04 04:39 PM


All times are GMT +1. The time now is 07:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"