Hello,
I'm just learning to work with arrays, and right now I'm able to fill an Array with values from another Array where the Value is >= 990000.
1st Array = arrAR
2nd Array = arrNonAR
I'm first storing a Range of values into the 1st array that will be used to populate the 2nd array with values that are greater than or equal to 990000.
I'm expecting to get 1,238 values into the 2nd array, however it's only being filled with 989… based on the Array size (0 to 988). I should note that the Table column is formatted as General, and changing it to Number had no positive effect.
Interestingly enough, if I remove the double-quotes from the criteria number, it returns a smaller number of results:
Thank you and best regards,
I'm just learning to work with arrays, and right now I'm able to fill an Array with values from another Array where the Value is >= 990000.
1st Array = arrAR
2nd Array = arrNonAR
I'm first storing a Range of values into the 1st array that will be used to populate the 2nd array with values that are greater than or equal to 990000.
I'm expecting to get 1,238 values into the 2nd array, however it's only being filled with 989… based on the Array size (0 to 988). I should note that the Table column is formatted as General, and changing it to Number had no positive effect.
Any help would be greatly appreciated.
VBA Code:
Sub WIP_Array_NonAR()
'Declarations
Dim arrAR As Variant, arrNonAR As Variant, i As Long
'Fill Array - All Quiz Numbers
arrAR = wsBooks.Range("t_Books[Quiz]") 'A3:A49946
'Initialize Array for NonAR Values
ReDim arrNonAR(0)
'Fill NonAR Array with values >= "990000"
For i = LBound(arrAR) To UBound(arrAR)
If (arrAR(i, 1) >= "990000") Then
arrNonAR(UBound(arrNonAR)) = arrAR(i, 1) 'Add Quiz number to array for selected row
ReDim Preserve arrNonAR(UBound(arrNonAR) + 1) 'Resize array +1 index
i = i + 1 'index counter
End If
Next i
'Remove last/empty index
ReDim Preserve arrNonAR(UBound(arrNonAR) - 1) 'expecting 1238; returning 988
End Sub
Interestingly enough, if I remove the double-quotes from the criteria number, it returns a smaller number of results:
VBA Code:
If (arrAR(i, 1) >= 990000) Then
Thank you and best regards,