我在 Excel 中编写了一个用户定义函数。它工作得很好,没有任何问题。我什至在对象属性菜单下为它写了一个描述。
问题是,当我开始输入函数时,我的 UDF 从未出现在 Excel 下拉菜单中。我希望用户在进入单元格并开始输入函数时能够看到我的 UDF(名为removeNumbers)。
我也希望他们能够看到我写的描述,就像标准的 Excel 函数一样。
最后,有没有一种方法可以为我的函数作为输入的每个参数提供描述?
这是实际的代码,尽管我认为没有必要回答我的问题。
Function removeNumbers(sInput As String, sChoice As Boolean) As String
Dim sSpecialChars As String
Dim i As Long
If (sChoice = True) Then 'if true is selected, will remove all number including 0
sSpecialChars = "0123456789" 'This is your list of characters to be removed
For i = 1 To Len(sSpecialChars)
sInput = Replace$(sInput, Mid$(sSpecialChars, i, 1), "")
Next
End If
If (sChoice = False) Then 'if false is selected, will remove all numbers excluding zero
sSpecialChars = "123456789" 'This is your list of characters to be removed
For i = 1 To Len(sSpecialChars)
sInput = Replace$(sInput, Mid$(sSpecialChars, i, 1), "")
Next
End If
removeNumbers = sInput
End Function
最佳答案
要使该函数显示在下拉列表中,您必须将其放置在标准模块中,而不是工作表代码区域中。
关于Excel UDF 未出现在下拉菜单中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22561422/