View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default A curious OVERFLOW problem

VBA will attempt to use the smallest common data type when performing
operations on untyped constants.

So since 182 will fit in an integer, the internal result of the
multiplication will be placed in an integer, even if it will be assigned
to a long integer variable. And yes, an integer can be up to 32767
(2^15-1).

If you declare at least one constant to be of type long, the result will
be calculated and placed in a temporary long internal variable, then
coerced if necessary during assignment to your variable:

a = 182& * 182&


In article ,
Myles wrote:

What's happening ?