第1个回答 2011-10-26
Excel VBA的列子:
Public Function QiuHe(LookupRange As Range)
Dim InputValue, ReturnValue As Integer
InputValue = LookupRange.Value
ReturnValue = 0
If Len(LookupRange) <> 3 Or TypeName(InputValue) = "String" Then
MsgBox "not 3 digits integer, program stop!"
Exit Function
End If
ReturnValue = Application.Sum(Int(InputValue / 100), (Int(InputValue / 10) - Int(InputValue / 100) * 10), (InputValue - Int(InputValue / 10) * 10))
QiuHe = ReturnValue
End Function本回答被提问者采纳