![]() |
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 |
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 |
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 |
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 |
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. |
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 |
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. |
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. |
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? |
All times are GMT +1. The time now is 08:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com