Private Sub Command1_Click()
Dim M1 As Integer, N1 As Integer, I As Integer
N1 = InputBox("请输入查找范围的最小值:")
M1 = InputBox("请输入查找范围的最大值:")
For I = N1 To M1
If Yues(I) = I Then Print I
Next I
End Sub
Private Function Yues(YUanshu As Integer) As Integer
Yues = 1
For I = 2 To YUanshu - 1
If YUanshu Mod I = 0 Then Yues = Yues + I
Next I
End Function