© 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 Microsoft Excel Macros
the simple way!


In most cases, short, simple macros can instruct Microsoft Excel to perform the same complex operations that long, complex macros do. Simple macros tell Excel to do only what you want it to do and nothing more. But, if you are a macro-writing beginner, you will soon discover that finding simple Excel macro samples to study is not easy.

The macro example below appears in several online Excel macro-writing tutorials. It inserts a worksheet and names it "NewName".

Sub AddSheetsTutorialExample()
Dim newSheetName As String
newSheetName = "NewName"
Sheets.Add Type:="Worksheet"
      With ActiveSheet
           .Move after:=Worksheets(Worksheets.Count)
           .Name = newSheetName
      End With
End Sub


But even this relatively short macro has unnecessary lines. My, shorter, simpler version works equally well!

Sub AddSheetsTutorialExampleRevised()
      With ActiveSheet
           .Move after:=Worksheets(Worksheets.Count)
           .Name = "NewName"
     End With
End Sub

My macro-writing motto is: If you don't need it, DELETE it!

Short, simple macros save macro error-checking time, a few bytes of computer space, and a couple of nanoseconds of macro runtime.

But, even more important is the fact that learning to write simple macros is much easier, and much more fun! Why boggle your mind if you don't have to?

If you like my approach to writing macros, click here to see my mini-tutorial on writing simple Microsoft Excel macros.