how to make a macro and run in every excel book that opened?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I make a macro and assigned that macro to customized menu bar.
Seems that macro doesn’t run in other book.

Somebody know how to make a macro and run in every excel book that opened?
Or the reference/article to do so?

Thanks in advance
 
save the code in Personal.xls or in an xla that is saved in the lstart
folder. it will open when excel does, and the code will be available to all
workbooks
 
Hi Patrick,

I tried to save as in .xla extension and tick the Wayan analysis in
tool>Add-Ins but the messages 'book4.xls' could not be found.etc....etc....etc

where is the lstart located?
 
Patrick means xlstart iso lstart. It is the defaulft folder for excel to
open all workbooks contained there.
Look also in tool/options, general tab.
For the others part of your question, remeber that your macro will execute
on the active workbook, which is also the last opened oen, except if you
activate another one manually or by code. To overcome this, yuou should
specify on which workbook you macro will apply (as your code is not in your
post, I presume that it is the explanation.

Sub test
Dim x as integer
Dim wb as Workbook
for each wb in application.Workbooks
wb.Worksheets( ???).range("A1")= ???
or
Worksheets( ???).activate
wb.activate
range("A1)= ....
next wb

Regards

Jean-Yves
 

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