Hello guy我在VBA中有一个用户定义的函数
Function clean(word As String, ParamArray characters() As Variant) As String
For i = 0 To UBound(characters)
word = Replace(word, characters(i), "")
Next i
clean = word
End Function
每当我尝试在另一个子程序中使用它时
Sub prova()
Dim wb As Workbook
Dim wsB As Worksheet
Set wb = ThisWorkbook
Set wsB = wb.Sheets("Bond Holdings")
wsB.Range("R3").Formula = "=clean(""dfsduuu"",""u"")"
End Sub
我得到运行时错误1004.你能帮助我找出原因吗?这让我发疯了。
谢谢
答案 0 :(得分:2)
Excel有一个名为CLEAN
的内置函数。你有一个名字冲突。如果您致电您的功能,例如cleaner
,它会按预期工作。