Example
- Open Excel
- Open the Visual Basic Editor ( see Opening the Visual Basic Editor )
- Add a new module by clicking Insert --> Module :
- 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 :
- Go back to your workbook and type "=Hello()" into a cell to see the "Hello World".