View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Myles[_7_] Myles[_7_] is offline
external usenet poster
 
Posts: 1
Default A curious OVERFLOW problem


Has anyone attempted to perform 182*182 operation in VBA? The followin
code generates an ovwerflow error in spite of the declarations.

Sub test()
Dim x as Long

x= 182*182 'overflow error on this line
Msgbox x

End sub

The problem persists even with a DOUBLE declaration for x. Treating
as a variant either by default (no declaration) or explicitly (b
declaration) doesn't help either.

As 181*181=32761, which reminds one of the magical figure 2 ^15 ther
must be some connection here.


What's happening ?


Myle

--
Myle
-----------------------------------------------------------------------
Myles's Profile: http://www.excelforum.com/member.php...fo&userid=2874
View this thread: http://www.excelforum.com/showthread.php?threadid=49208