Excel UDF没有出现在下拉菜单中 [英] Excel UDF not appearing in drop down menu

查看:96
本文介绍了Excel UDF没有出现在下拉菜单中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Excel中编写了一个用户定义的功能.它运行良好,没有任何问题.我什至在对象属性菜单下对此进行了描述.

问题是,我的UDF永远不会出现在我开始键入函数时出现的Excel下拉菜单中.我希望用户在进入单元格并开始键入函数时能够看到名为removeNumbers的UDF.

我也希望他们能够看到我写的描述,就像标准的Excel函数一样.

最后,有没有一种方法可以为我的函数作为输入的每个参数提供描述?

这是实际的代码,尽管我认为没有必要回答我的问题.

 函数removeNumbers(sInput作为字符串,sChoice作为布尔值)作为字符串Dim sSpecialChars作为字符串昏暗的我只要如果(sChoice = True)那么'如果选择true,将删除所有数字,包括0sSpecialChars ="0123456789"'这是您要删除的字符列表对于i = 1到Len(sSpecialChars)sInput = Replace $(sInput,Mid $(sSpecialChars,i,1),")下一个万一如果(sChoice = False)那么'如果选择false,将删除除零以外的所有数字sSpecialChars ="123456789"'这是您要删除的字符列表对于i = 1到Len(sSpecialChars)sInput = Replace $(sInput,Mid $(sSpecialChars,i,1),")下一个万一removeNumbers = sInput结束功能 

解决方案

要使该功能显示在下拉列表中,您必须将其放置在标准模块中,而不是工作表代码区域中./p>

I wrote a User Defined Fucntion in Excel. It works great with no issues. I even wrote a description for it under the object properties menu.

The problem is, my UDF never shows up in the Excel drop down menu that appears when I start to type a function. I want the user to be able to see my UDF, named removeNumbers, when they go into a cell and start to type out a function.

I would also like them to be able to see the description which I wrote, just like the standard Excel functions.

And finally, is there a way that I can provide a description for each argument which my function takes as input?

Here is the actual code, although I don't think it will be necessary to answer my questions.

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

解决方案

To make the function appear in the drop-down you must place it in a standard module rather than the worksheet code area.

这篇关于Excel UDF没有出现在下拉菜单中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆