简体   繁体   English

UDF无法在Excel 2010中识别

[英]UDF is not recognised in excel 2010

I am having a problem with incorporating User Defined Functions in excel. 我在合并Excel中的用户定义函数时遇到问题。 For some reason the function is not recognised. 由于某些原因,无法识别该功能。 The (simplified) code is as follows: (简化的)代码如下:

Option Explicit
Option Base 1

Function Dummy(A As Range, _
               B As Range, _
               C As Double, _
               D As Double) As Double

' This function doesn't do anything

End Function

When I use the function in a cell it returns the #NAME? 当我在单元格中使用该函数时,它返回#NAME? error. 错误。 在此处输入图片说明

Strangely enough when I started typing "=du" in the cell excel did find the function. 当我开始在excel单元格中输入“ = du”时,确实很奇怪,但确实找到了该函数。 在此处输入图片说明

When I use the error checking function of excel this clearly shows that the function is not recognised. 当我使用excel的错误检查功能时,这清楚地表明该功能未被识别。 在此处输入图片说明

I know this error can occur in case the VBA module is stored in a user form, a sheet or "ThisWorkbook". 我知道,如果VBA模块存储在用户表单,工作表或“ ThisWorkbook”中,则可能会发生此错误。 However that is not the case here. 但是,这里不是这种情况。 在此处输入图片说明

Can anyone tell me what I am doing wrong here? 谁能告诉我我在做什么错?

Rename your module or your function. 重命名您的模块或函数。 The module name and the function name cannot both be "Dummy". 模块名称和功能名称不能都为“虚拟”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM