TheRedCardinal
Active Member
- Joined
- Jul 11, 2019
- Messages
- 252
- Office Version
- 365
- 2021
- Platform
- Windows
I have the following function:
My whole macro is returning no matches.
I've stepped through this process and all of the variables look right.
When I hover over the "SearchArray(MyCount, Vector) line to see what the variable is, I get <Internal Error> shown.
When I query the same array location in the Immediate bar then I get the (correct) result.
But the macro doesn't crash - it just returns 0 from the function each time.
This process has worked before and the only changes I've made have been in the worksheets themselves, not the code.
Can anybody tell me what this problem could be?
VBA Code:
Function FindInvoice(Search As Double, Vector As Variant, SearchArray As Variant) As Long
For MyCount = LBound(SearchArray, 1) To UBound(SearchArray, 1)
If SearchArray(MyCount, Vector) = Search Then
FindInvoice = MyCount
Exit Function
End If
Next MyCount
MyCount = 0
End Function
My whole macro is returning no matches.
I've stepped through this process and all of the variables look right.
When I hover over the "SearchArray(MyCount, Vector) line to see what the variable is, I get <Internal Error> shown.
When I query the same array location in the Immediate bar then I get the (correct) result.
But the macro doesn't crash - it just returns 0 from the function each time.
This process has worked before and the only changes I've made have been in the worksheets themselves, not the code.
Can anybody tell me what this problem could be?