Explicit declaration of variables

If you are going to create a complex sequence of macros, it is a good idea to declare your variables using a Dim statement in each subroutine. This prevents any confusion over whether a variable is local to a subroutine or a global one (variables declared outside of subroutines are global). For example:

Sub MyTest

Dim x, y 

x = 24 

x = "Hello" 

y = 12 

x = x & " " & y 

End Sub