With this code i copy 8 lines to a table. The table is +/- 35 columns wide.
Dim y As Integer
For y = 0 To 7
nRow = shP.Range("B" & shP.Rows.Count).End(xlUp).Offset(1).Row
shP.Cells(nRow, 2) = shJ.Cells(7, 13 + y).Value
shP.Cells(nRow, 3) = 41
shJ.Range("$D$9").AutoFilter Field:=1, Criteria1:="=40", _
Operator:=xlOr, Criteria2:="=41"
shJ.Range(Cells(10, 13 + y), Cells(shJ.Cells(Rows.Count, 3).End(xlUp).Row, 13 + y)).Copy
shP.Cells(nRow, 4).PasteSpecial Paste:=xlPasteValues, Transpose:=True
shP.Cells(nRow + 1, 2) = shJ.Cells(7, 13 + y).Value
shP.Cells(nRow + 1, 3) = 42
shJ.Range("$D$9").AutoFilter Field:=1, Criteria1:="=40", _
Operator:=xlOr, Criteria2:="=42"
shJ.Range(Cells(11, 13 + y), Cells(shJ.Cells(Rows.Count, 3).End(xlUp).Row, 13 + y)).Copy
shP.Cells(nRow + 1, 4).PasteSpecial Paste:=xlPasteValues, Transpose:=True
Next y
But because there are cell with a Matrixformule witch more then one cell the code gives a error.
To prefend to copy in a table and get this error i stop the table from expending with this.
Application.AutoCorrect.AutoExpandListRange = False
But when i use
Application.AutoCorrect.AutoExpandListRange = True
the table don't expand on it own.
How to expand a table or copy matrix formulas with more then one cell to a table?
The table in in sheet "PKB" and the table is called "PKB".
Bookmarks