VBA Long data type overflow

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
 
J

J.E. McGimpsey

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

Chip Pearson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top