0

I am trying to create a dynamic range starting at 1. I do not want to use "Option 1" because the program also uses 0-based arrays.

I cannot use:

Dim arValues(1 To LastRow, 1 To LastColumn)

"compiler error: must be constant "

This also does not work:

Dim numbers(1 To 6, 1 To 4) As Variant)
ReDim numbers(3, 2)

I can do:

Dim numbers() As Variant
ReDim numbers(5, 3)
ReDim numbers(3, 2)

But not:

Dim numbers(5,3) As Variant      (or Dim numbers(1 To 6, 1 To 4) As Variant)
ReDim numbers(3, 2)

That does not make sense!

Any ideas?

Sorry, somehow the '''code''' thing does not work

1

1 Answer 1

0

This is the way:-

Dim numbers() As Variant
ReDim numbers(1 To 6, 1 To 4)

In case you are thinking of making the array dynamic, note that only the last vector can be modified after the first ReDim.

Sign up to request clarification or add additional context in comments.

Comments

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.