Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Funny notation with #

Tags:

excel

vba

what does this mean?

if CDbl(Trim(Range("M" & r).Text)) > 0# then...

what does the # do?? and what does cdbl do?

like image 929
Alex Gordon Avatar asked May 13 '10 18:05

Alex Gordon


2 Answers

****Here is a Cheat Sheet for DataTypes ****

Variable End with:

$ : String
% : Integer (Int16)
& : Long (Int32)
! : Single
# : Double
@ : Decimal

Start with:

&H : Hex
&O : Octal

Comparison between VB and VB.Net (reference)

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

Convert to:

CBool(expression)
CByte(expression)
CCur(expression)
CDate(expression)
CDbl(expression)
CDec(expression)
CInt(expression)
CLng(expression)
CLngLng(expression) (Valid on 64-bit platforms only.)
CLngPtr(expression)
CSng(expression)
CStr(expression)
CVar(expression)
like image 55
Gerhard Powell Avatar answered Oct 02 '22 14:10

Gerhard Powell


CDbl() convert an expression to a Double:

A data type that holds double-precision floating-point numbers as 64-bit numbers in the range -1.79769313486231E308 to -4.94065645841247E-324 for negative values; 4.94065645841247E-324 to 1.79769313486232E308 for positive values.

"#" is the "type-declaration character" for a Double. Following a number with this symbol means that it will treat the number as a double instead of trying to guess what exact variable type to use (it would likely have treated the 0 as a integer without this)

like image 42
BradC Avatar answered Oct 02 '22 13:10

BradC