Forum Discussion

hugo francisco jiménez novoa's avatar
May 30, 2022
Solved

Add help info to UDF

Hi everyone, just a quick question here... It is possible to add help information to a UDF to let the user know how the UDF works and what the possible errors are, and the data is needed for the UDF to function properly?

 

I want Excel to display that help info like any native formula. If possible...

 

Appreciate any help you can give me.

 

 

  • hugo francisco jiménez novoa 

    You can use Application.MacroOptions. Here is a very simple example:

    Function CelsiusToFahrenheit(t As Double) As Double
     CelsiusToFahrenheit = 1.8 * t + 32
    End Function
    
    Sub AddDescriptiom()
        Application.MacroOptions Macro:="CelsiusToFahrenheit", _
           Description:="Convert Celsius to Fahrenheit", _
           ArgumentDescriptions:=Array("Temperature in degrees Celsius")
    End Sub

    Running the AddDescription macro adds a description of the function as a whole and of its arguments. These will be used if you press fx when creating a formula:

9 Replies

  • hugo francisco jiménez novoa 

    You can use Application.MacroOptions. Here is a very simple example:

    Function CelsiusToFahrenheit(t As Double) As Double
     CelsiusToFahrenheit = 1.8 * t + 32
    End Function
    
    Sub AddDescriptiom()
        Application.MacroOptions Macro:="CelsiusToFahrenheit", _
           Description:="Convert Celsius to Fahrenheit", _
           ArgumentDescriptions:=Array("Temperature in degrees Celsius")
    End Sub

    Running the AddDescription macro adds a description of the function as a whole and of its arguments. These will be used if you press fx when creating a formula:

Resources