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".
Dim newSheetName As String
newSheetName = "NewName"
.Name = newSheetName
But even this relatively short macro has unnecessary lines. My, shorter, simpler version works equally well!
.Name = "NewName"
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.