Private Function prime(n As Integer) As Boolean Dim m As Integer For m = 2 To Sqr(n) If n Mod m = 0 Then Exit Function Next m prime = True End Function