Attempting to create a smaller array from a larger array. I feel I've been able to get parts of it to work... except for the most critical part.
Unfortunately, when I get to "inarr1(i-3, j-1) = inarray(i, j)", I get a "run-time error 13, type mismatch".
As an FYI, inarray was previous defined and populated as follows in a preceding subroutine:
Any thoughts would be appreciated.
VBA Code:
'NOTE: inarray was passed into this subroutine as follows: Sub PreComboReset(ByRef inarray As Variant)
Dim inarr1 as Variant
'NOTE: use LastRowb because this range could change and is inside the larger array.
LastRowb = Sheets("sheet2").Range("B5:B24").Find(What:="*", After:=Sheets("sheet2").Range("B5:B24").Cells(1, 1), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
For i = 4 To (LastRowb - 1)
For j = 2 To LastRowb
'Debug.Print inarray(i, j) 'I used this debug.print to verify that I was getting the data I was expecting to get.
inarr1(i-3, j-1) = inarray(i, j) 'copies contents of one array into another
Next j
Next i
Unfortunately, when I get to "inarr1(i-3, j-1) = inarray(i, j)", I get a "run-time error 13, type mismatch".
As an FYI, inarray was previous defined and populated as follows in a preceding subroutine:
VBA Code:
Dim inarray As Variant
inarray = Sheets("Sheet2").Range("A2:X24").Value2
Any thoughts would be appreciated.