Sorted it!

Looks like the MOD calculator is limited to the LONG range, but the INT operator is not.

Changed logic to use

Dim Whole as Variant

Whole = CDec(Int(Long_Number / Divisor))

Remainder = Long_number - (Whole * Divisor)



Seems to work fine now - handles the full range of DECIMAL numbers.

(For reference, I'm writing a base-conversion utility and need to be able to handle extremely long hex numbers. My numbers ar enot restricted to just Hex, therefore I can;t use any of the built-in functions.)