XL97: Run-time Error Evaluating Immediate Window Expression

Last reviewed: February 27, 1998
Article ID: Q160587
The information in this article applies to:
  • Microsoft Excel 97 for Windows

SYMPTOMS

When you type a mathematical formula similar to the following in the Immediate window in the Visual Basic Editor:

   ?200*200

you receive the following error message:

   Run-time Error 6:
   Overflow

CAUSE

This problem occurs when the result of the calculation you type in the Immediate window is too large to be represented by an Integer type expression; the result exceeds the limit for the Integer type expression.

RESOLUTION

To resolve this behavior, assign the Long integer data type to any mathematical functions that return a value larger than 32,767. To assign the Long integer data type in the Immediate window, use the ampersand (&) character. The following example illustrates the syntax to use:

   ?200&*200

STATUS

This behavior is by design of Microsoft Excel 97.

MORE INFORMATION

Long integer variables are stored as signed 32-bit (4-byte) numbers that range in value from -2,147,483,648 to 2,147,483,647. The type declaration character for Long is the ampersand (&) character.

Integer variables are stored as 16-bit (2-byte) numbers that range in value from -32,768 to 32,767.

REFERENCES

For more information about Long integer data types, click the Index tab in Visual Basic for Applications Help, type the following text

   long

and then double-click the selected text to go to the "Long data type" topic.

For more information about Integer data types, click the Index tab in Visual Basic for Applications Help, type the following text

   integer

and then double-click the selected text to go to the "Integer data type" topic


Additional query words: XL97
Keywords : kberrmsg kbtool xlvbainfo
Version : WINDOWS:97
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 27, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.