TheRedCardinal
Active Member
- Joined
- Jul 11, 2019
- Messages
- 252
- Office Version
- 365
- 2021
- Platform
- Windows
My code does the following:
The variables a and b are used to identify the "columns" of the array and work ok.
The problem: I never get a value for Counter3 except 0.
Hovering over each expression in Step Through mode tells me that all parameters are working correctly, except that the search term in final array looks like a number (e.g. 9200) but in the search array, it is the same number inside quotation marks, so "9200". In fact, every line (including empties) in the search array is enclosed in "".
This is not returning a match.
I have tried:
But so far to no avail.
Can anybody see a way around this?
- Loads in a range from a worksheet into an array
- Loads in a range from another worksheet into a separate array
- Loops through the first array in a specific column
- Searches a column in the second array and counts how many times it appears
VBA Code:
For Counter2 = 1 To UBound(IStat, 1)
If FinalArray(Counter, a) = IStat(Counter2, b) Then Counter3 = Counter3 + 1
Next Counter2
The variables a and b are used to identify the "columns" of the array and work ok.
The problem: I never get a value for Counter3 except 0.
Hovering over each expression in Step Through mode tells me that all parameters are working correctly, except that the search term in final array looks like a number (e.g. 9200) but in the search array, it is the same number inside quotation marks, so "9200". In fact, every line (including empties) in the search array is enclosed in "".
This is not returning a match.
I have tried:
- Formatting the whole source data for both arrays as text
- Formatting the specific columns as numbers
But so far to no avail.
Can anybody see a way around this?