Is there a way to make UDF that gives a description like the native Excel functions have when user clicks the Fx button?

后端 未结 5 1177
后悔当初
后悔当初 2020-12-05 03:13

If I type =vlookup( (or any other native Excel function) in the formula bar and then click the little Fx button to the left of the formula I get a Function Argu

5条回答
  •  时光取名叫无心
    2020-12-05 03:46

    Create function like I have created below: Function CompanyNames:

    Function CompanyNames(CompanyCode As Integer, Data As Range) As String
    
    CompanyNames = WorksheetFunction.VLookup(CompanyCode, Data, 2, False)
    
    
    End Function
    

    Run below code once and you get the argument description in Function

    Sub DescribeFunction()
    
    Dim FuncName As String
    Dim FuncDesc As String
    Dim Category As String
    Dim ArgDesc(1 To 2) As String
    
    FuncName = "CompanyNames"
    FuncDesc = "Returns the Company Name"
    
    ArgDesc(1) = "Provide the Company Code"
    ArgDesc(2) = "Select Range to lookup"
    
    
    Application.MacroOptions _
      Macro:=FuncName, _
      Description:=FuncDesc, _
      Category:=Category, _
      ArgumentDescriptions:=ArgDesc
    End Sub
    

提交回复
热议问题