S
SonnyMaou
why would i get an overflow error on this line:
MsgBox Trim(inv * 64)
when inv is only 671?
MsgBox Trim(inv * 64)
when inv is only 671?
Long data type
A 4-byte integer ranging in value from -2,147,483,648 to
2,147,483,647. The ampersand (&) type-declaration character
represents a Long in Visual Basic.
type-declaration character
A character appended to a variable name indicating the variable's
data type.
JE said:Because... Hence the overflow.
There's almost never a need to use integers on modern computers (it can
actually waste processor cycles) - use long integers instead
Dim inv As Long
instead.
Alternatively, cast 64 as a long integer (&) or a double (#):
MsgBox Trim(inv * 64&)