Reputation: 3538
I've created the following function in 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
When I use the function in a spreadsheet, Only the second if statment works, the first statement results in #value. I believe my sytax is correct, so I'm not sure where I am going wrong.
Thanks
Upvotes: 0
Views: 66
Reputation: 10139
Does this help you?
Public Function GetBTM(bai As Integer, comment As String, amt As Double)
If (bai = 195) Then
GetBTM = "Customer Wires"
ElseIf (bai = 399 And Application.WorksheetFunction.Find("MOV TIT", comment) > 0) Then
GetBTM = "Customer Wires"
End If
End Function
Upvotes: 1