Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Long data type overflow
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Long data type overflow
VBA long is 4byte(32bit) signed.
If you need larger numbers try Currency which is 8byte scaled integer see VBA help DataType summary. keepITcool < email : keepitcool chello nl (with @ and .) < homepage: http://members.chello.nl/keepitcool (Jean Stax) wrote: Dim NumberP As Long NumberP = 1078282205 * 31 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Long data type overflow
Different applications/compilers/environments do define data types
differently. For Excel (from XL/VBA Help): Long Data Type Long (long integer) variables are stored as signed 32-bit (4-byte) numbers ranging in value from -2,147,483,648 to 2,147,483,647. The type-declaration character for Long is the ampersand (&). In article , (Jean Stax) wrote: 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Long data type overflow
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 "Jean Stax" wrote in message om... 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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Long data type overflow
http://msdn.microsoft.com/library/de...us/vblr7/html/
vadatlong.asp Which includes a caution about VB6 Longs. -- Regards, Tom Ogilvy Chip Pearson wrote in message ... 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 "Jean Stax" wrote in message om... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
http://CannotDeleteFile.net - Cannot Delete File? Try Long Path ToolFilename is too long? Computer Complaining Your Filename Is Too Long? TheLong Path Tool Can Help While most people can go about their businessblissfully unaware of the Windo | Excel Discussion (Misc queries) | |||
when I type a long number it shows up as smaller number and + | Excel Discussion (Misc queries) | |||
how do I type long paragraph into a cell? | Excel Discussion (Misc queries) | |||
Data overflow to second worksheet | Excel Worksheet Functions | |||
VBA overflow | Excel Programming |