Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Unhiding specific worksheets in VBA (Excel 2003)

I struggle with the "unhide part"
the sub: Workbook_SheetFollowHyperlink does not seems to work on my
computer.. the rest seems to be 100%


"Bob Phillips" wrote:

Here is one suggestion that seems to work.

The hyperlink fires and meks the sheet visible before linking. Deactivating
the sheet hides it again. It assumes the hyperlinks are all on a sheet
called Master

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
If Sh.Name < "Master" Then
Sh.Visible = False
End If
End Sub

Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target
As Hyperlink)
Dim iPos As Long
Application.EnableEvents = False
iPos = InStr(Target.SubAddress, "!")
Worksheets(Left(Target.SubAddress, iPos - 1)).Visible = True
Target.Parent.Hyperlinks(1).Follow
Application.EnableEvents = True
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Jinx" wrote in message
...
One simple means I'll run by the business owner will be to hide the tabs

all
together:
ActiveWindow.DisplayWorkbookTabs = False
Any other suggestions?

"Jinx" wrote:

Hi all,
I have a workbook containing ~60 worksheets in which I would like to

hide
~50 of them but have individual worksheets open on demand. The

worksheets
contain hyperlinks to other worksheets within the same workbook and are
simply referenced as an Excel hyperlink. On clicking a hyperlink I

would
like it to unhide the relevant worksheet, on hitting the Excel Web

'back'
button I would like it to rehide the relevant worksheet.
Is this feasible as currently constructed or am I looking at additional
macros to replace the hyperlinking?
Extract of the code doing the worksheet hiding:
---
Private Sub Workbook_Open()
On Error GoTo ErrorHandler
Dim wst As Worksheet

'Ensure the Data sheet is hidden and can't be shown without password
ThisWorkbook.Worksheets("Data").Visible = xlVeryHidden

'Ensure the Exchange Rate sheet is hidden and can't be shown without
password
ThisWorkbook.Worksheets("ExchangeRates").Visible = xlVeryHidden

'protect the Worksheets from alteration
For Each wst In ThisWorkbook.Worksheets
wst.Protect (PWORD)
Next wst

'Unprotect the Exchange Rate Worksheet to obtain Reuters updates
ThisWorkbook.Worksheets("ExchangeRates").Unprotect PWORD

'activate the MainMenu worksheet
ThisWorkbook.Worksheets("MainMenu").Activate

'define the data range names
DefineDataColumns

'sort the specifed data ranges
SortDataRanges "Data_AssociatedDealerGroup", "Data_DealerNames",
"Data_DealerIDs"
SortDataRanges "Data_AssociatedUnitCode", "Data_RMCodes"
SortDataRanges "Data_RMUnitCodes", "Data_RMUnitNames"
SortDataRanges "Data_AssDealerGrp", "Data_AssMarginTempl"

Exit_Workbook_open:
Exit Sub
ErrorHandler:
DisplayError Err.Number, Err.Description
Resume Exit_Workbook_open
End Sub
---
Any help will be greatly appreciated - I have read through the other
discussion threads, but I don't see anything specific to my

requirements.
Regards,




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
Excel - unHiding a column affects columns in other worksheets? John Powell Excel Worksheet Functions 3 February 10th 07 12:23 AM
(Unsuccessfully!) Unhiding Rows in Excel 2003 [email protected] Excel Worksheet Functions 6 May 24th 06 08:17 PM
Unhiding worksheets Oldjay Excel Discussion (Misc queries) 9 May 23rd 06 07:38 PM
Unhiding multiple worksheets in Excel 2000 Juana Cafe Excel Worksheet Functions 1 September 8th 05 08:50 PM
Unhiding rows in Excel 2003 Jim Rech Excel Programming 0 January 8th 04 03:54 PM


All times are GMT +1. The time now is 05:53 AM.

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"