I am trying to do some prime factorisation with my VBA excel and I am hitting the limit of the long data type –
Runtime Error 6 Overflow
Is there any way to get around this and still stay within VBA? I am aware that the obvious one would be to use another more appropriate programming language.
Lance’s solution works in so far that I am able to get the big numbers into the variables now. However, when I try to apply the MOD function – bignumber MOD 2, for example – it still fails with error message
Runtime Error 6 Overflow
MOD is trying to convert your DECIMAL type to LONG before operating on it. You may need to write your own MOD function for the DECIMAL type. You might try this:
where A & B are DECIMAL subtype of VARIANT variables, and r might have to be that large also (depending on your needs), though I only tested on a long.