Floating commandbar problem -- toolbars destroyed only if sheet first upon opening ... ?

  • Thread starter Thread starter StargateFanFromWork
  • Start date Start date
S

StargateFanFromWork

I have 3 sheets in a workbook. One sheet has a floating toolbar that only
it needs. The 2 other sheets have this code in them:



Private Sub Worksheet_Activate()
Application.CommandBars("My Spreadsheet").Visible = False
End Sub
Private Sub Worksheet_Deactivate()
Application.CommandBars("My Spreadsheet").Visible = True
End Sub



That works great as long as the one sheet (the first one) that _does_ need
the toolbar is the one that is showing first. If either of the other 2 that
don't need it are what one sees first, I have to click over to the first
sheet and then back to either of the other 2 before it disappears. I've
been trying to remember to close this workbook on the first worksheet but
don't always remember. Is there perhaps a better way to handle this toolbar
deactivate issue? TIA.
 
I would put the code only in the 1 sheet that you want the Command bar to
appear in.
Activate:
..Visible = True
Deactivate:
..Visible = False
 
Back
Top