LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
tom tom is offline
external usenet poster
 
Posts: 570
Default unhide sheets

Hi all,
I have a list in C8:C17 that lists the names of sheets that I would like to
have a macro that UNHIDES the sheets that are listed. Bob Phillips provided
me with this code that works, however, it has a drawback in that after I
enter in the name of the sheet, I have to actually DELETE the contents of
that cell before the macro will run. The sheets that I am UNHIDING have
VLOOKUP formulas on them that reference otheR cells on that main sheet so the
sheet name needs to stay visible for VLOOKUP to have a reference.
Can someone modify this so that the macro will run without having to delete
the cell contents.

Thanks!

Option Explicit

Private Const WS_RANGE As String = "C8:C17" '<=== change to suit
Private prevVal As String

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Value = "" Then
If prevVal < "" Then
Worksheets(prevVal).Visible = True
End If
Else
Worksheets(.Value).Visible = False
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
prevVal = Target.Value
End If
End Sub


 
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
unhide sheets Tom Excel Programming 4 February 1st 07 12:06 PM
Help unhide sheets sdubose99[_2_] Excel Programming 10 April 15th 06 06:07 PM
Unhide sheets Brian Matlack[_24_] Excel Programming 1 November 10th 05 07:45 PM
How to Unhide sheets pwermuth Excel Discussion (Misc queries) 4 July 15th 05 11:43 PM
Add sheets that are unhide Bob Phillips[_5_] Excel Programming 0 September 17th 03 10:43 PM


All times are GMT +1. The time now is 12:51 AM.

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

About Us

"It's about Microsoft Excel"