title: Assigning an array to another array in one line
body: <p>I'm new to VBA, and I can't seem to work out a very simple concept - assigning one array to another, both being of equal size and type. Like in this example:</p>
  
  <pre><code>Option Explicit
  
  Sub main()
      Dim arr1(2), arr2(2) As Double
  
      arr1(0) = 5
      arr1(1) = 10
  
      arr2 = arr1 'error here
  
      Debug.Print arr2(0)
      Debug.Print arr2(0)
  End Sub
  </code></pre>
  
  <p>Running this returns an error </p>
  
  <blockquote>
    <p>"Can't assign to array"</p>
  </blockquote>
  
  <p>Now, I know I can iterate through every element with a For loop, but in some advanced cases, it is impractical to use - for example, I have a slow-loading function that returns an array, and because of that, I'd like to run it only once, taking it's whole return value and assigning to some other array, like this:</p>
  
  <pre><code>arr1 = Very_Slow_Function_That_Returns_An_Array()
  </code></pre>
  
  <p>But obviously, this won't work either, and will produce the same error. So, what can be done? Can someone give some advice on how to assign a whole array to another array without having to iterate through every element?</p>