'判断一个数m是否是完数,是则返回True,否则返回False
Function TestWanShu(ByVal m as Long) As Boolean
Dim Sum As Long
Dim i As Long
If m <2 Then
TestWanShu=False
Exit Function
End If
Sum=1
For i=2 To m-1
If m Mod i =0 then Sum=Sum+i
Next
If Sum=m Then
TestWanShu=True
Else
TestWanShu=False
End If
End Function