Variable Declaration
In most cases in VBA, you can leave out Option Explicit
(often omitted by default, anyway) and skip Dim
'ing many of your variables.
In doing so, this (96 Chars):
Option Explicit
Sub Test()
Dim S As String
Dim S2 As String
S = "Test"
S2 = S
MsgBox S2
End Sub
Option Explicit
Sub Test()
Dim S As String
Dim S2 As String
S = "Test"
S2 = S
MsgBox S2
End Sub
Becomes this (46 chars):
Sub Test()
S = "Test"
S2 = S
MsgBox S2
End Sub
Sub Test()
S = "Test"
S2 = S
MsgBox S2
End Sub
If you need to use certain objects (for example, arrays), you may still need to Dim
that variable.