VBA Long data type overflow

  • Thread starter Thread starter Jean Stax
  • Start date Start date
J

Jean Stax

Hi !

The following code generates Overflow error:

Dim NumberP As Long
NumberP = 1078282205 * 31

According to MSDN:
Long variables are stored as signed 64-bit (8-byte) integers ranging
in value from -9,223,372,036,854,775,808 through
9,223,372,036,854,775,807.

What is going wrong there ?
Maybe VBA Long data size differs from VB Long data size ?

Thanks
 
Different applications/compilers/environments do define data types
differently. For Excel (from XL/VBA Help):
 
Jean,

Longs are 4-bytes (32-bits) ranging in value from -2,147,483,648 to
2,147,483,647 . Where did you find that definition in MSDN?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Back
Top