Skip to main content
deleted 1 character in body
Source Link
Taylor Raine
  • 8.7k
  • 2
  • 27
  • 51

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.

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

Becomes this (46 chars):

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.

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

Becomes this (46 chars):

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.

Mod Removes Wiki by Doorknob
deleted 23 characters in body
Source Link
Gaffi
  • 3.7k
  • 2
  • 23
  • 54

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

Becomes this (46 chars):

Sub Test()
S = "Test"
S2 = S
MsgBox S2
End Sub

(I may be mistaken about this next bit...) If you need to use certain objects (for example, arrays), you may still need to Dim that variable.

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

Becomes this (46 chars):

Sub Test()
S = "Test"
S2 = S
MsgBox S2
End Sub

(I may be mistaken about this next bit...) If you need to use certain objects, you may still need to Dim that variable.

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

Becomes this (46 chars):

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.

edited body
Source Link
Gaffi
  • 3.7k
  • 2
  • 23
  • 54

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 (9596 Chars):

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

(I may be mistaken about this next bit...) If you need to use certain objects, you may still need to Dim that variable.

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 (95 Chars):

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

(I may be mistaken about this next bit...) If you need to use certain objects, you may still need to Dim that variable.

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

Becomes this (46 chars):

Sub Test()
S = "Test"
S2 = S
MsgBox S2
End Sub

(I may be mistaken about this next bit...) If you need to use certain objects, you may still need to Dim that variable.

added 35 characters in body
Source Link
Gaffi
  • 3.7k
  • 2
  • 23
  • 54
Loading
added 24 characters in body
Source Link
Gaffi
  • 3.7k
  • 2
  • 23
  • 54
Loading
Added info/formatting
Source Link
Gaffi
  • 3.7k
  • 2
  • 23
  • 54
Loading
Source Link
Gaffi
  • 3.7k
  • 2
  • 23
  • 54
Loading