Private Sub Command1_Click()
Dim M As Single, I As Single
J = 0
For M = 2 To 1000
If M = 2 Then Print M;
I = 1
Do
I = I + 1
Loop Until (M Mod I = 0) Or (I = M - 1)
If M Mod I <> 0 Then
Print M;
J = J + 1
If J Mod 10 = 0 Then Print
End If
Next M
End Sub