0

I would like to know if there a way to change array names while looping.

for example

For i= 1 to 4
    "array" & i()
Next i

array1 ,array2,array3,array4 are my 4 arrays.

Thanks

7
  • You can use double-dimensional arrays - msdn.microsoft.com/en-us/library/d2de1t93(v=vs.90).aspx - and then you can just change an index of required array easily. Commented Oct 1, 2015 at 17:51
  • 1
    Any time you find yourself needing to change the names of your variables is the time to re-think your approach. If you really need to do this then consider storing your arrays in a Scripting Dictionary object with the "names" as keys. Commented Oct 1, 2015 at 18:04
  • If you edit this question to where it is clear what you're trying to do. (Code sample doesn't even seem to be trying to do anything useful) someone may be able to give you an alternative. As it is though, it's unclear what you're asking. Commented Oct 1, 2015 at 18:06
  • Ok, I have 4 different arrays and i want to use the longest array among these 4 arrays. so how do i get the longest array name?. Commented Oct 1, 2015 at 18:14
  • 1
    If you use an array of arrays then you can loop over them and pick the largest one. Commented Oct 1, 2015 at 21:17

1 Answer 1

1

To quote my favourite StackOverflow answer:

Short Answer: No.
Long Answer: Noooooooooooooo.

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.