Hello Excel Forum,

I have a 2 dimensional array that will be constructed at runtime and contain an unknown number of rows and a fixed number of columns. The array will reside within a custom class. I have a sub within the class (below) that builds the array depending upon some cell values in a worksheet. However, I'm having trouble re-dimensioning the array.

I transpose the array, which is declared as a private variable within a custom class, so that I can change the number of rows (i.e. the first dimension) while preserving the contents of the array, then transpose it back. The code breaks at the line indicated. What am I missing? All help and comments appreciated.

Sub AssignProjects(ExecCell As Range)

    For i = 4 To 20
        If ExecCell.Offset(0, i).value <> "" Then
            Application.Transpose (pProjects)
            ReDim Preserve pProjects(UBound(pProjects, 1), UBound(pProjects, 2) + 1)     'CODE BREAKS HERE WITH "SUBSCRIPT OUT OF RANGE" ERROR
            Application.Transpose (pProjects)
            
            '.... code to add data .......

        End If
    Next i

End Sub

Private Sub Class_Initialize()
    ReDim pProjects(1 To 1, 1 To 2)
End Sub
Thanks