VBA does not provide a MAXINT constant. But you can easily get this value:
MAXINT = (2 ^ 15) -1 Debug.Print MAXINT 32767
Or you can define it as a Public constant with this in the Declarations section of the standard module:
Public Const MAXINT As Integer = (2 ^ 15) - 1
Then MAXINT will be available for the rest of your VBA code in this application.
And for Long Integer maximum value ...
MAXLONG = (2 ^ 31) -1 Debug.Print MAXLONG 2147483647
Hansup
source share