Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
units = ActiveCell.Value overflow
The subject pretty much sums it up. I've got a number in a cell that i want to divide by 3, but for some reason i keep getting an overflow error when i try to save a number from a cell into a variable. The variable is an int, and the number shouldn't be too big to fit. Thanks for the help, Chris -- cbh35711 ------------------------------------------------------------------------ cbh35711's Profile: http://www.excelforum.com/member.php...o&userid=30276 View this thread: http://www.excelforum.com/showthread...hreadid=566328 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
units = ActiveCell.Value overflow
Try changing the variable type to Double. Int is not going to accept your value if it has decimals. -- Excelenator ------------------------------------------------------------------------ Excelenator's Profile: http://www.excelforum.com/member.php...o&userid=36768 View this thread: http://www.excelforum.com/showthread...hreadid=566328 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
units = ActiveCell.Value overflow
What's the number. What happens if you change the type to Long.
-- Regards, Tom Ogilvy "cbh35711" wrote in message ... The subject pretty much sums it up. I've got a number in a cell that i want to divide by 3, but for some reason i keep getting an overflow error when i try to save a number from a cell into a variable. The variable is an int, and the number shouldn't be too big to fit. Thanks for the help, Chris -- cbh35711 ------------------------------------------------------------------------ cbh35711's Profile: http://www.excelforum.com/member.php...o&userid=30276 View this thread: http://www.excelforum.com/showthread...hreadid=566328 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
units = ActiveCell.Value overflow
Int is not going to accept
your value if it has decimals. I couldn't reproduce that: b% = 8/7 ? b% 1 ? typename(b) Integer It certainly won't hold the decimal portion, but that won't cause an overflow error. -- Regardes, Tom Ogilvy "Excelenator" wrote in message ... Try changing the variable type to Double. Int is not going to accept your value if it has decimals. -- Excelenator ------------------------------------------------------------------------ Excelenator's Profile: http://www.excelforum.com/member.php...o&userid=36768 View this thread: http://www.excelforum.com/showthread...hreadid=566328 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
units = ActiveCell.Value overflow
You can easily overload a long... Sub OverKill() Dim d#, l& d = 1E+100 l = d End Sub -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam Tom Ogilvy wrote in What's the number. What happens if you change the type to Long. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
units = ActiveCell.Value overflow
perfect, worked great. Thanks Chris -- cbh35711 ------------------------------------------------------------------------ cbh35711's Profile: http://www.excelforum.com/member.php...o&userid=30276 View this thread: http://www.excelforum.com/showthread...hreadid=566328 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
units = ActiveCell.Value overflow
Really. So they weren't kidding in the help when they said:
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 -- Regards, Tom Ogilvy "keepITcool" wrote in message .com... You can easily overload a long... Sub OverKill() Dim d#, l& d = 1E+100 l = d End Sub -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam Tom Ogilvy wrote in What's the number. What happens if you change the type to Long. |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
units = ActiveCell.Value overflow
You can easily overload a double...
Sub OverflowDouble() Dim d# d = CDbl(1E+308) * 2# End Sub is that helpful? -- Regards, Tom Ogilvy "keepITcool" wrote in message .com... You can easily overload a long... Sub OverKill() Dim d#, l& d = 1E+100 l = d End Sub -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam Tom Ogilvy wrote in What's the number. What happens if you change the type to Long. |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
units = ActiveCell.Value overflow
Tom, okay i was blunt:)
my point was.. a cell may hold a large floating point value. even when assigned to a long variable it can overload. (infamous example: ?cells.count in excel 2007) Tip for OP: an integer holds -32768 to +32768 only. a long holds from -2 to +2 billion. IN VBA just dont just Integer but Long for al your counters. the extra bytes dont matter as much as they did in 1980. -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam Tom Ogilvy wrote in You can easily overload a double... Sub OverflowDouble() Dim d# d = CDbl(1E+308) * 2# End Sub is that helpful? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Units Produced / (finish time minus start time)=Units Per Hr | Excel Worksheet Functions | |||
If activecell.column = variable then activecell,offset (0,1) | Excel Discussion (Misc queries) | |||
Overflow | Excel Programming | |||
VBA overflow | Excel Programming | |||
VBA overflow | Excel Programming |