Thread: dim trouble
View Single Post
  #7   Report Post  
JE McGimpsey
 
Posts: n/a
Default

VBA's calculation engine uses the most restrictive typing in its
calculations, so if you have multiply two integers, the result is an
integer. If the result is too large, you'll get an overflow error.

This applies to intermediate calculations as well. So the result of

(HOUR * 3600)

since HOUR is an Integer, and 3600 by default is an integer, will be an
integer. If HOUR 9, an overflow will occur.

If you use the Long type-declaration character (&):

(HOUR * 3600&)

VBA will reserve an internal Long variable for the result (since one of
the arguments is a Long), and your calculation will carry through.



In article ,
jocke wrote:

if the variabel hour is declared integer, must the result of any
multiplying with "hour" be less than 32767 or else it will fail?