0

I'm trying to write a function that checks for prime numbers and returns true if a number is prime. Something simple, i'm just a beginner. Here's what I have, does it make sense..if not any input would be appreciated.

Function IsPrime(ByVal dblCheck As Double) As Boolean

Dim intNumber As Integer

For intNumber = 2 To dblCheck - 1

If dblCheck Mod intNumber = 0 Then

IsPrime = False

Exit Function

End If

Next intNumber

IsPrime = True

'return prime numbers

Return dblCheck

End Function 'IsPrime