【发布时间】:2017-09-27 19:36:41
【问题描述】:
我在 Excel VBA 中创建了以下函数:
Function GetBTM(bai As Integer, comment As String, amt As Double)
If (bai = 195) Then
GetBTM = "Customer Wires"
End If
If (bai = 399 And Application.WorksheetFunction.Find("MOV TIT", comment) > 0) Then
GetBTM = "Customer Wires"
End If
End Function
当我在电子表格中使用该函数时,只有第二个 if 语句有效,第一个语句会产生 #value。我相信我的语法是正确的,所以我不确定我哪里出错了。
谢谢
【问题讨论】:
-
多个 IF 语句在 Excel VBA 中运行良好,我一直在使用它们。我会检查
GetBTM = "Customer Wires"中的实际文本,那里可能有一个不可打印的字符。
标签: excel if-statement user-defined-functions vba