Adding a macro to a button.

P

pauluk

Hello,

Can some one please direct me or explain how i can create a butto
which runs a macro. I create a button whichs runs a macro on
workbook. But what i want is to creat a button which contains the macr
which then run on any sheet which is open.

Is this possible if so how do i do it
 
T

Tom Ogilvy

A macro has to be stored in a workbook. Where it performs its actions is
dependent on how you write the macro.

Even if you tie a macro to a button on the menus/commmandbars, it is stored
in a workbook and if not already open, the workbook is opened and the macro
run when the button is clicked.
 
B

BrianB

You cannot "contain a macro in a button".

The usual procedure is to have all the macros we use regularly in
workbook called by tradition "personal.xls" - although it can have an
name. We can have this open automatically when Excel starts by havin
it in the Microsoft office/XLSTART folder. Normally we set it to b
hidden with Window/Hide. If it is saved that way when Excel prompts a
close-down it will stay hidden until Unhide
 
B

Bob Phillips

Paul,

You need to put it on the toolbar, and assign a macro. To make it generally
available, I suggest you add to the Personal.xls file.

The macro should work on the activeworkbook and activesheet.

One for the code tips?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
P

pauluk

Bob it may also be useful to add the following link to this refernece i
is to be placed on the tips part of the site

As i think people would store certain macros in the personel.xls fil
in order to use on other sheets\workbooks

http://tinyurl.com/2gyv
 
B

Bob Phillips

If it were, I think it would need elaborating on to make it more generic,
more useful.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Top