1

I have an array of arrays. Its dimensions can be summed like this:
varZaznamyNove(0)(1 to 2, 1 to 20) as shown in the picture.

I want to take an entire row and put the data from that row into an Excel table. For example:
Range(objListRowBytoveDomyNovy.Range(1, 1), objListRowBytoveDomyNovy.Range(1, 20)) = varZaznamyNove(0)(intPorovnavanyZaznamNovy)

When I attempt to run the line, I get an error:

Run time error 9: Subscript out of range.

How can I put entire row from a jagged array, without looping through all of its columns, into an excel table?

Variables used are dimensioned as follows:
objListRowBytoveDomyNovy as lisrow
intPorovnavanyZaznamNovy as integer
varZaznamyNove(0) as variant

Note:
I don't get an error, when I add second index to the right side of the line, e.g.:
Range(objListRowBytoveDomyNovy.Range(1, 1), objListRowBytoveDomyNovy.Range(1, 20)) = varZaznamyNove(0)(intPorovnavanyZaznamNovy,1)
but this only pust first column into all of the table columns. That is not desired.

Example of the data is shown in picture. Just to show what I work with (dummy data).

Example of the data

1 Answer 1

1

You can do this:

Range(objListRowBytoveDomyNovy.Range(1, 1), objListRowBytoveDomyNovy.Range(1, 20)).Value = Application.Index(varZaznamyNove(0), intPorovnavanyZaznamNovy, 0)
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much! I love plain and simple solutions. Nice article about the topic

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.