0

I simply have the issue that I need to create an array with a number of arrays. the problem is that the number of the arrays are only known at runtime. so, how can initialize (create) the array with the correct size?

Thanks a lot!

2
  • 1
    You'll have to run some code that figures it out first. Commented Jun 3, 2014 at 22:04
  • 1
    I guess the key here is ReDim as what @brettdj posted which Re-dimensions array at runtime. Commented Jun 4, 2014 at 5:35

1 Answer 1

1

As per Ron's comment, use variables to set your array when it is known.

Dim lngRow As Long
Dim lngCol As Long
Dim X()
lngRow = 100
lngCol = 15
ReDim X(1 To lngCol, 1 To lngRow)
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your help. I didn't want to use matrix arrays before but it might help me. I need to figure that out. Anyway, I found another question with well described solutions. Give me some time to understand the difference between those and your solutions. Thank you so far.
I could find a way to use the matrix array effectively. Thanks for the help.

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.