View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
cagey63 cagey63 is offline
external usenet poster
 
Posts: 7
Default Custom CommandBar visible dependent on active sheet

Similar to an earlier post (noted below), I've created custom command
bars with associated macros pertaining to the data on a specific Excel
sheet. In other words, I want to see only the toolbar containing the
commands pertaining to the sheet when a sheet is selected. Here is
the code I've tried:

Private Sub Worksheet_Activate()
If ActiveSheet.Name = ("SheetA") Then
.CommandBars("SheetA").Visible = True
Else
.CommandBars("SheetA").Visible = False
End If

If ActiveSheet.Name = ("SheetB") Then
.CommandBars("SheetB").Visible = True
Else
.CommandBars("SheetB").Visible = False
End If

If ActiveSheet.Name = ("SheetC") Then
.CommandBars("SheetC").Visible = True
Else
.CommandBars("SheetC").Visible = False
End If
End Sub

Note that I already have code for enabling the toolbars on workbook
activation functioning.

Thanks.

Previous post:
http://groups.google.com/group/micro...ef929af02d7be1