Example
- Open Excel
- Open the Visual Basic Editor ( see Opening the Visual Basic Editor )
- Add a new module by clicking Insert --> Module :
![enter image description here](http://i.stack.imgur.com/0KhKM.png)
- Copy and Paste the following code in the new module :
Public Function Hello() As String
'Note: the output of the function is simply the function's name
Hello = "Hello, World !"
End Function
To obtain :
![enter image description here](http://i.stack.imgur.com/1r1E7.png)
- Go back to your workbook and type "=Hello()" into a cell to see the "Hello World".
![enter image description here](http://i.stack.imgur.com/PFQsX.png)