|
Alt+F11 to open Visual Basic Editor (VBE).
From the Insert menu, select Module (to add a module).
Enter the following lines of code into the module:
Function SumDigits(Number) Dim i As Integer For i = 1 To Len(Number) SumDigits = SumDigits + Val(Mid(Number, i, 1)) Next i End Function
To test the function:
To test the function, open Paste Function (Shift+F3).
From the User Defined category, select the SumDigits function.
In the function box, select any cell that contains a date.
Click OK.
|