ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Custom Toolbar Visibility (https://www.excelbanter.com/excel-discussion-misc-queries/116174-custom-toolbar-visibility.html)

RCW

Custom Toolbar Visibility
 
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.?

Bob Phillips

Custom Toolbar Visibility
 
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)

"RCW" wrote in message
...
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.?




RCW

Custom Toolbar Visibility
 
Worked great. Thanks alot.

"Bob Phillips" wrote:

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)

"RCW" wrote in message
...
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.?






All times are GMT +1. The time now is 04:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com