For some reason, custom functions don't seem to work in Excel. I created a simple function below, but it always returns zero as a value, regardless of whether it is used as a function of a worksheet or called from a procedure. Does anyone know what I'm doing wrong, or if there is somewhere where I am missing?
Public Function Testthisout(number As Double) As Double result = number * number End Function Public Sub TESTFUNCTION() Dim number As Double Dim result As Double Application.Volatile (True) number = 4 result = Testthisout(number) MsgBox result End Sub
source share