Asked By
gyle kugler
90 points
N/A
Posted on - 04/24/2013
Hi Coders!
I have been trying to create some functions in VBA to carry out some particular tasks. At the moment, I would like to develop a prime number calculator VBA for easy pupils' online learning. Is there anyone with a source code for a prime number calculator that I can use for this particular assignment? Thanks big time for your generosity.
I need a source code for prime number calculator VBA.
Hi,
Different website provides source code for prime number calculator. However, the required code is available  or Click here . Just use this code and then run it in the JavaScript and finally you will find things are working fine. Moreover, it's very simple and easy as well.
I need a source code for prime number calculator VBA.
In Excel, you can use the following code for determining prime numbers:
Dim divisors As Integer, number As Long, i As Long
divisors = 0
number = InputBox("Enter a number")
For i = 1 To number
If number Mod i = 0 Then
               divisors = divisors + 1
End If
Next i
If divisors = 2 Then
      MsgBox number & " is a prime number"
Else
     MsgBox number & " is not a prime number"
End If