I am Currently trying to write some code in VBA to solve a problem from Project Euler. I have been trying to answer a question that requires you to find primes that can be divided into a number that will not fit in a long. Any suggestions as how to handle this problem?
I know I can split the number between two variables and I have done that for addition and subtraction but never division. Any help will be appreciated.
We got the error “Overflow” because the Integer data type cannot hold anything more than 32767 for positive numbers and -32768 for negative numbers. Type Mismatch Error: Integer data can only hold numerical values between -32768 to 32767.
Long is a data type in VBA used to store the numeric values. We know that integer also holds numeric values, but Long differs from integers as the data storage range is very big. In the case of the Long data type, we can hold decimal values too. So, it is a built-in data type.
Holds signed 32-bit (4-byte) integers that range in value from -2,147,483,648 through 2,147,483,647.
You can define a Decimal data type (12 Bytes), but only within a variant.
Dim i As Variant
i = CDec(i)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With