how do I make a simple macro

  • Thread starter Thread starter mike
  • Start date Start date
M

mike

I'd like to create a simple macro that I can give to other
people and that they can load and assign to a button. How
do I do that without creating a project? Or do I have to
create a project? The macro I have in mind consists of
just a few lines I need to automate a couple of processes,
nothing fancy.

mike
 
The easiest way is just to use the Macro Recorder (Tools>>Macro>>Record New
Macro). Walk through the steps you want a few times first, just to make
sure you have everything lined out right and you're not going to miss
anything. Then launch the recorder. When the recorder pops up, name the
macro and save it in your Personal.XLS.

After you're done and you close the recorder, you can hit ALT+F11; that
opens the VBA Editor. If it doesn't open to your macro, you can go to
Tools>>Macros and select it from the list. If you copy everything from "Sub
[MacroName]()" to "End Sub", you can paste it into any text editor and email
it. I'd also recommend saving it as a separate document - if you wind up
making changes and something goes bad, you can always restore it.

If you run into any snags, let us know. If the code doesn't work, copy it
and paste it into a post back here. Tell us what you were trying to
accomplish and what the macro did/didn't do instead, and most likely someone
here can help.

Good luck!
Ed
 
Macros are stored in workbooks. You can create it and export it to a bas
file, but to run it, it must be in a workbook.
 
As far as I know, you'll have to create an Excel Workbook, Template, or Addin to distribute your macro. Using a Template is probably the easiest way.
 
Back
Top