Array of Array?

I have a method
addRow(cols() as string, child as table=nil)
Rows.append(cols)

where rows is:
Rows(-1) as Variant

Is this how I should be doing it, because this is acting oddly?

mParentTable.SetHeader(Array("Column 1", "Column 2", "Column 3", "Column 4")) mParentTable.AddRow(Array("R1C1", "R1C2", "R1C3", "R1C4"), nil) mParentTable.AddRow(Array("R2C1", "R2C2", "R2C3", "R2C4"), nil) mParentTable.AddRow(Array("R3C1", "R3C2", "R3C3", "R3C4"), nil) mParentTable.AddRow(Array("R4C1", "R4C2", "R4C3", "R4C4"), nil) mParentTable.AddRow(Array("R5C1", "R5C2", "R5C3", "R5C4"), nil)

The last element of this array is nil… but not out of bounds…

Are you sure it’s really nil? If so, something else is going on.

Also, why not use ParamArray to make your life easier, like this:

Sub addRow (child As Table = nil, ParamArray cols() As String)

mParentTable.addRow( nil, "R1C1", "R1C2", "R1C3", "R1C4" )

Hi Kem… Thanks a million for the recommendation.
I didn’t use param array because the last parameters of the method have default values.
i.e AddRow(cols() as string, hasChild=nil)
Cols varies in size so I can’t use the second solution.

I was thinking of using Join and Split, but the wondered what delimiter I could use such that it wouldn’t collide with the contents of one of the elements of the col array.

As always… it was my bug anyway.

I only mentioned it because you were supplying nil in the method calls anyway. Just a thought.