© Merry L. Morris
Introduction to writing simple macros
Writing OCLC Connexion Client Macros
OCLC Connexion Client Macro Mini-tutorial (Some of) My OCLC Connexion Client Mini-macros
Writing Microsoft Excel Macros
Excel macro mini-tutorial
Excel Macros Simplified
(Some of) My Excel Mini-macros

Writing Excel Macros
the simple way!


---------------Mini-tutorial---------------

This mini tutorial is for people who have read my introduction to writing simple macros and who have at least looked at my OCLC Connexion Client macros section. My macro-writing philosophy is always the same: write macros that tell the software to do only what you need it to do and nothing more.

Before you begin, decide which repetitive task you will be automating with your Excel macro. Then, follow the steps below to create your macro.

Step 1:           next

Select Tools, Macros, Record new macro


Step 2:       prev           next

Type a clever name for your macro


Step 3:       prev           next

Complete all the steps in the repetitive task, then select

Tools, Macros, Stop recording



To study the syntax of your macro and/or to edit your macro, follow these steps:

Step 1:       prev           next

Select tools, macros


Step 2:       prev           next

Click to select your macro name.
Step 3:       prev           next

Click Edit.


Step 4:       prev           next

Look at the macro code.


The macro shown here selects cells A1 through F1 and merges them.


Step 5:           prev           next

Make changes ... you could change the macro shown above to merge cells B5 through H5 ... or cells Z100 through Z500 ... or any other range ...

You can type changes ... OR, paste into your macro part of another macro you copied from somewhere else ...

For example, you could create another macro which does something else to cells A1 through A5 ...


The macro shown above resulted from recording while selecting cells A1 through A5, then clicking on the center button on the formatting toolbar.
center button


... then highlight, copy, ...



and paste ONLY the lines of code you need into your original merge macro ...



... to create a simple macro (without all those unnecessary lines) that merges cells A1 through A5, then formats the merged cells so that any text you enter in them will be centered.

And, of course, in many cases, you can DELETE LINES! (If you would like to see how I reduced needlessly long macros generated by the Excel macro recorder to much shorter ones, click here)



To run your macro:
Step 1:       prev           next

Select Tools, Macros    

Step 2:           prev           next
Click to highlight your macro name.




Step 3:           prev
Click run.



Remember, all the simple macro-writing techniques you learned in the OCLC Connexion Client macro-writing mini-tutorial apply when you write Excel macros!

And that includes creating variables the simple way! Click here to see more.

Back to top of page