ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro on tool bar (https://www.excelbanter.com/excel-programming/326138-macro-tool-bar.html)

Randy Starkey

macro on tool bar
 
Hi,

I have a macro tied to a toolbar button, and it will operate on multiple
worksheets. If I only want it to work for just ONE specific worksheet, what
do I need to do in the code? Is there a way to load that tool bar ONLY when
that specific worksheet is selected? Or do I have to put the button on the
sheet to do that?

Thanks!

--Randy Starkey



Ron de Bruin

macro on tool bar
 
Hi Randy

If it is for one workbook create your button with code when you activate the
workbook and delete it when you deactivate it

See
http://support.microsoft.com/default...b;EN-US;830502

Use this events in the thisworkbook module to run your code

Private Sub Workbook_Activate()

End Sub


Private Sub Workbook_Deactivate()

End Sub

See
http://www.cpearson.com/excel/events.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Randy Starkey" wrote in message ...
Hi,

I have a macro tied to a toolbar button, and it will operate on multiple worksheets. If I only want it to work for just ONE
specific worksheet, what do I need to do in the code? Is there a way to load that tool bar ONLY when that specific worksheet is
selected? Or do I have to put the button on the sheet to do that?

Thanks!

--Randy Starkey





All times are GMT +1. The time now is 09:21 PM.

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