Resolved...
Found this:
In Microsoft Excel, when you run a Microsoft Visual Basic for Applications procedure that contains a mathematical calculation, you may receive the following error message:
Run-time error '6':
Overflow
Back to the top
CAUSE
This error message appears when the mathematical calculation involves numbers o...
This error message appears when the mathematical calculation involves numbers or variables of one data type, such as Integer, and you assign the result of the calculation to a variable of a different data type, such as Double or Long, even if the result of the calculation is within the range of the data type for the resulting variable. For example, you receive this error message when you run the following procedure:
Sub Test()
Dim MyVarInteger As Integer
Dim MyVarDouble As Double
MyVarInteger = 256
MyVarDouble = 256 * MyVarInteger
End Sub
The error message occurs in this case because the number 256 is a constant of Integer data type. Because the variable MyVarInteger is also a value of Integer data type, the multiplication calculation is performed as an Integer calculation. The error message occurs because the result of the calculation, 65536, is larger than the range for an Integer data type (which must be between -32768 and 32767).
By declaring the result, MyVarDouble, as Double data type, the calculation multiplies the two Integer data types and then attempts to convert the result to a Double data type. Because the result is not within the range for an Integer data type, the error occurs before the result is converted to the Double data type.
'****************************
Sure enough... if you change the variables to long clng(VarName) the problem is fixed!
Wow... I can't believe I never noticed this before!
Close the thread.