The result of a numeric operation, value conversion, or assignment is outside the range of allowable values for the result data type.

Do one or both of the following:

  • Change the numeric data type of one or more values being used in the operation, conversion, or assignment.
  • Change the destination data type to accommodate the result. For example:
Dim N As Long

I% = 30000            ' Declare I implicitly as an Integer.
J% = 10000            ' J is also an Integer.
Print (I% + J%)       ' Overflow from numeric operation. The number
                      ' 40000 cannot be represented as an Integer.
Print CInt(40000&)    ' Overflow from attempted conversion of
                      ' a Long value to an Integer value.
Invar% = 40000        ' Overflow from attempted assignment of
                      ' a large value to an Integer variable.
N = 40000             ' No error. N was declared a Long.
MN = 40000            ' No error. MN is implicitly declared a Long
                      ' by the assignment of a large value to it.