Private Sub Command1_Click()
For i = 2 To 1000
Sum = 0
For j = 1 To i \ 2
If i Mod j = 0 Then
Sum = Sum + j
End If
Next j
If Sum = i Then Print i
Next i
End Sub