Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
821 views
in Technique[技术] by (71.8m points)

excel - Handling numbers larger than Long in VBA

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

Dim i As Variant

i = CDec(i)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...