Just when I think I understand how this works, the Out Of Range (error 9) pops up and I can't figure out why.
In a Subroutine called ReadChart I define and populate the following array. It also passes that array information onto another subroutine called PreComboSort:
As a result of the above, inarayp was defined as being one demensional with 20 rows. However, the values found in Sheets("Sheet2").Range("AF5:AF24") can range anywhere from 4, 8, 12, 16 or 20 numbers. In my example here, there were only 8 values in these cells and they were 1, 2, 3, 4, 5, 6, 7 and 11. The rest of the cells are presumed to be blank.
Upon passing this array to the PreComboSort subroutine, I was hoping to redefine the array so when I go to perform tasks such as "for each member", I will only be looking at rows where there are actual values to look at. So, I attempt to do just that with the following with the PrecomboSort subroutine:
And the last line is where I get my error. I'm guessing there is something simple I'm forgetting but I'm having difficulty understanding what it might be. Any help would be appreciated.
Thanks,
Don
In a Subroutine called ReadChart I define and populate the following array. It also passes that array information onto another subroutine called PreComboSort:
VBA Code:
Dim inarrayp As Variant 'Array containing priority players only
inarrayp = Sheets("Sheet2").Range("AF5:AF24").Value2
PreComboSort inarray, inarrayp
As a result of the above, inarayp was defined as being one demensional with 20 rows. However, the values found in Sheets("Sheet2").Range("AF5:AF24") can range anywhere from 4, 8, 12, 16 or 20 numbers. In my example here, there were only 8 values in these cells and they were 1, 2, 3, 4, 5, 6, 7 and 11. The rest of the cells are presumed to be blank.
Upon passing this array to the PreComboSort subroutine, I was hoping to redefine the array so when I go to perform tasks such as "for each member", I will only be looking at rows where there are actual values to look at. So, I attempt to do just that with the following with the PrecomboSort subroutine:
VBA Code:
Sub PreComboSort(ByRef inarray As Variant, inarrayp As Variant)
Dim LastRowa As Long
LastRowa = Sheets("Sheet2").Range("AF5").End(xlDown).Row
ReDim Preserve inarrayp(1 To LastRowa) As Variant
And the last line is where I get my error. I'm guessing there is something simple I'm forgetting but I'm having difficulty understanding what it might be. Any help would be appreciated.
Thanks,
Don