I'm trying to use my own made function inside custom data validation formula. But for some reason it does not work.
My function:
我正在嘗試在自定義數據驗證公式中使用我自己的函數。但由於某種原因,它不起作用。我的功能:
Public Function IsNumberXValid(x) As Boolean
IsNumberXValid = IsNumeric(x) And Math.Cos(x) <> 1
End Function
When I put this function inside formula field it shows following warning:
當我將此函數放在公式字段中時,它顯示以下警告:
What am I doing wrong?
我究竟做錯了什么?
4
With normal worksheet functions, it is easy to apply DV:
使用普通的工作表函數,可以很容易地應用DV:
It is slightly more complex with a UDF() This approach uses a "helper" cell.
使用UDF(稍微復雜一點)這種方法使用“輔助”單元格。
I begin with a tiny UDF():
我從一個小的UDF()開始:
Public Function IsPrime(L As Long) As Boolean
arr = Array(5, 7, 11)
IsPrime = False
For Each a In arr
If L = a Then
IsPrime = True
Exit Function
End If
Next a
End Function
The UDF() returns True
for a couple of inputs. I want to apply DV to cell D1 using the udf() as a rule.
UDF()為幾個輸入返回True。我想使用udf()作為規則將DV應用於單元格D1。
I am using cell E1 as my "helper". In cell E1 I put my UDF():
我使用單元格E1作為我的“幫手”。在單元格E1中我放了我的UDF():
=IsPrime(D1)
Next I Name
my "helper" cell:
接下來我命名我的“助手”單元格:
Finally, I return to cell D1 and apply the DV:
最后,我返回到單元格D1並應用DV:
本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2016/10/09/7256f35cb1bfb68bdb3d8ec83a12ed0f.html。