ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding a macro to a button. (https://www.excelbanter.com/excel-programming/295643-adding-macro-button.html)

pauluk[_41_]

Adding a macro to a button.
 
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

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Adding a macro to a button.
 
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.

--
Regards,
Tom Ogilvy


"pauluk " wrote in message
...
Hello,

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

Is this possible if so how do i do it?


---
Message posted from http://www.ExcelForum.com/




BrianB

Adding a macro to a button.
 
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

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Adding a macro to a button.
 
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)

"pauluk " wrote in message
...
Hello,

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

Is this possible if so how do i do it?


---
Message posted from http://www.ExcelForum.com/




pauluk[_43_]

Adding a macro to a button.
 
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

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Adding a macro to a button.
 
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)

"pauluk " wrote in message
...
Bob it may also be useful to add the following link to this refernece if
is to be placed on the tips part of the site

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

http://tinyurl.com/2gyvn


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 03:49 PM.

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