Excel VBA Pound and Colon Signs Meaning?
The colon (:
) is a statement delimiter. It would be equivalent to a new line in VBA, or a semicolon in C (just to quote a random example). It allows you to write several instructions on a single line rather than going to a new line each time.
The pound (#
) is a short-hand type specifier that forces your literals to be double
, so basically 1#
is almost equivalent to 1.0
.
****Here is a Cheat Sheet for DataTypes ****
Variable End with:
$ : String
% : Integer (Int32)
& : Long (Int64)
! : Single
# : Double
@ : Decimal
Start with:
&H : Hex
&O : Octal
Visual Studio .Net added Literal Types (reference)
Value End with: (For more complete list, refer the the reference)
S : Short (Int16)
I : Integer (Int32)
L : Long (Int64)
F : Single
R : Double
D : Decimal