View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default Macro to enable or visible on specific worksheet only

Why not store the macro in "my data" ?

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Edgar" wrote in message
...
Hi,
I was not clear before i think.

I have a worksheet named "My data". There is only 1
worksheet in the xls file.
But the macro is in the Personal.xls file, which is
available to any other worksheet opened.

I want the macro to be visible only when this file(My
Data) is opened. And it should be disabled when this file
is closed.

this way I don't get to see the macro, when I am working
on other worksheets

thanks.
-----Original Message-----
In your personal.xls, in Workbook_Open , hide the toolbar

Application.Commandbars("Standard").Controls

("myButton").Visible = False

and then in the Workbook_Activate event for you

workbook, set it to true.

Tidy up with setting it to false in the

workbook_Deactivate event, and i the
personal.xls Workbook_BeforeClose event.

--
HTH

-------

Bob Phillips
"Edgar" wrote in

message
...
Hi,
I have a macro on personal workbook and have it visible
on the toolbars.

I would like have it made enable and visible only when

I
open a specific worksheet and not otherwise.

I am using excel 2002

pls advice



.