View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Macro-hide sub sheets?

this would be a start

Put this in the ThisWorkbook Module.

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim b1 As Long, b2 As Long
Dim sht As Worksheet, sChr As String
Select Case LCase(Sh.Name)
Case "original"
b1 = xlSheetVisible
b2 = xlSheetHidden
Case "future"
b1 = xlSheetHidden
b2 = xlSheetVisible
Case Else
Exit Sub
End Select
For Each sht In Worksheets
sChr = UCase(sht.Name)
If Len(sChr) = 1 Then
If sChr = "C" And sChr <= "H" Then
sht.Visible = b1
ElseIf sChr = "I" And sChr <= "N" Then
sht.Visible = b2
End If
End If
Next
End Sub

--
Regards,
Tom Ogilvy

"CLR" wrote in message
...
Hi All.....

I create various maps, or diagrams in Excel. There are two major types,
"ORIGINAL", and "FUTURE". Each type has several support sheets to go

with
it. I was wondering if it would be possible to create a macro that would
automatically expose to view, only those sheets (sheets C-H)associated

with
the ORIGINAL sheet when I click on that one, and then hide those and

expose
only those (sheets I-N) associated with the FUTURE sheet when I click on

that
one, and back and forth.

TIA for any ideas.....

Vaya con DIos,
Chuck, CABGx3