ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Troubleshoot Overflow (https://www.excelbanter.com/excel-programming/410829-troubleshoot-overflow.html)

JingleRock[_2_]

Troubleshoot Overflow
 
I have read that the Overflow Error is frequently associated with
variable declaration. Do you have any suggestions, other than trial
and error in changing declarations, for troubleshooting this error?
Thanks for your help.

Gary''s Student

Troubleshoot Overflow
 
Formulate expresions to demand Double or Long math:

Sub bad_math()
MsgBox (24 * 60 * 60)
End Sub

will fail on overflow, but:

Sub good_math()
MsgBox (24# * 60 * 60)
End Sub

will work just fine.
--
Gary''s Student - gsnu200785


"JingleRock" wrote:

I have read that the Overflow Error is frequently associated with
variable declaration. Do you have any suggestions, other than trial
and error in changing declarations, for troubleshooting this error?
Thanks for your help.


FSt1

Troubleshoot Overflow
 
hi
nope. this is one case where experience really does help but even so,
everyone hits an "oops" now and then
best way is to think out your declarations before hand.
in vb help look up data type summary for most of the fine points.

Regards
FSt1

"JingleRock" wrote:

I have read that the Overflow Error is frequently associated with
variable declaration. Do you have any suggestions, other than trial
and error in changing declarations, for troubleshooting this error?
Thanks for your help.


Dave Peterson

Troubleshoot Overflow
 
Don't use "As Integer"; use "As Long".

Don't use "As Single"; use "as double".



JingleRock wrote:

I have read that the Overflow Error is frequently associated with
variable declaration. Do you have any suggestions, other than trial
and error in changing declarations, for troubleshooting this error?
Thanks for your help.


--

Dave Peterson


All times are GMT +1. The time now is 10:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com