定义三个listbox
Option Explicit
Private Sub Form_Click()
Dim i As Long, j As Long
List1.AddItem ("奇数")
List2.AddItem ("偶数")
List3.AddItem ("素数")
For i = 1 To 1000
If i Mod 2 = 1 Then
List1.AddItem (i)
End If
If i Mod 2 = 0 Then
List2.AddItem (i)
End If
For j = 2 To i - 1
If i Mod j = 0 Then
Exit For
ElseIf j = i - 1 Then
List3.AddItem (i)
End If
Next j
Next i
End Su