Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Tom,
Still stumped because the following generates same overflow error. You would imagine the declaration will fix the problem. Sub test() Dim x As Double x = 253 * 8520000 MsgBox x End Sub "Tom Ogilvy" wrote in message ... ? 252*8520000 2147040000 works, but 253*8520000 doesn't because it exceeds the maximum size of a long ? 300#*8520000 2556000000 works because it forces conversion to Double 2556*10^6 does the same for the same reason. That would be my guess. -- Regards, Tom Ogilvy "David Myle" wrote in message ... Hi all, My VBA editor returns a Run time overflow error for 300*8520000 but calculates without any fuss 2556*10^6 Yet both figures are the same viz: 2556000000 The same editor has no problem evaluating 2556*10^300 What gives? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That doesn't force the calculate to be performed as double - just the
results, but the error has already occured. Sub test() Dim x As Double x = 253# * 8520000 MsgBox x End Sub -- Regards, Tom Ogilvy "David Myle" wrote in message ... Hi Tom, Still stumped because the following generates same overflow error. You would imagine the declaration will fix the problem. Sub test() Dim x As Double x = 253 * 8520000 MsgBox x End Sub "Tom Ogilvy" wrote in message ... ? 252*8520000 2147040000 works, but 253*8520000 doesn't because it exceeds the maximum size of a long ? 300#*8520000 2556000000 works because it forces conversion to Double 2556*10^6 does the same for the same reason. That would be my guess. -- Regards, Tom Ogilvy "David Myle" wrote in message ... Hi all, My VBA editor returns a Run time overflow error for 300*8520000 but calculates without any fuss 2556*10^6 Yet both figures are the same viz: 2556000000 The same editor has no problem evaluating 2556*10^300 What gives? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your diagnosis and solution are spot on! As a check, a SINGLE coercion of
x = 253! * 8520000 also rides the error. Many thanks DM "Tom Ogilvy" wrote in message ... That doesn't force the calculate to be performed as double - just the results, but the error has already occured. Sub test() Dim x As Double x = 253# * 8520000 MsgBox x End Sub -- Regards, Tom Ogilvy "David Myle" wrote in message ... Hi Tom, Still stumped because the following generates same overflow error. You would imagine the declaration will fix the problem. Sub test() Dim x As Double x = 253 * 8520000 MsgBox x End Sub "Tom Ogilvy" wrote in message ... ? 252*8520000 2147040000 works, but 253*8520000 doesn't because it exceeds the maximum size of a long ? 300#*8520000 2556000000 works because it forces conversion to Double 2556*10^6 does the same for the same reason. That would be my guess. -- Regards, Tom Ogilvy "David Myle" wrote in message ... Hi all, My VBA editor returns a Run time overflow error for 300*8520000 but calculates without any fuss 2556*10^6 Yet both figures are the same viz: 2556000000 The same editor has no problem evaluating 2556*10^300 What gives? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
vlookup puzzle | Excel Worksheet Functions | |||
VLOOKUP puzzle ?? | Excel Worksheet Functions | |||
Can you help!!!!! New Puzzle | Excel Discussion (Misc queries) | |||
VBA overflow | Excel Programming | |||
VBA overflow | Excel Programming |