Custom Toolbar Visibility

G

Guest

I have a workbook with multiple custom toolbars. Some only work right on a
single worksheet. Is there a way to have only Custom Toolbar 1 visible when
sheet 1 is selected, only Custom Toolbar 2 visible when sheet 2 is selected,
etc.?
 
B

Bob Phillips

You need to make them visible/not visible in the appropriate worksheet
Activate/Deactivate events.

Private Sub Worksheet_Activate()
Application.CommandBars("myToolbar").Visible = True
End Sub

Private Sub Worksheet_Deactivate()
Application.CommandBars("myToolbar").Visible = False
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
G

Guest

Worked great. Thanks alot.

Bob Phillips said:
You need to make them visible/not visible in the appropriate worksheet
Activate/Deactivate events.

Private Sub Worksheet_Activate()
Application.CommandBars("myToolbar").Visible = True
End Sub

Private Sub Worksheet_Deactivate()
Application.CommandBars("myToolbar").Visible = False
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top