Open Visual Basic Editor.
Choose Insert and Module in the editor.
An empty code module appears.
Add the following code:
Public Function Add(number1 As Double, number2 As Double)
Add = number1 + number2
End Function
Return to Excel to find and use the function in the Insert Function dialog box
Enter =Add(1,2).