Adding a macro to a button.

  • Thread starter Thread starter pauluk
  • Start date Start date
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
 
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.
 
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
 
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)
 
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
 
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)
 

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

Back
Top