Handling numbers larger than Long in VBA

Agent389 picture Agent389 · Dec 3, 2009 · Viewed 38.6k times · Source

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.

Answer

Arnon picture Arnon · Oct 6, 2016

You can define a Decimal data type (12 Bytes), but only within a variant.

Dim i As Variant

i = CDec(i)