title: how to fill an array with a fixed pattern vba?
body: <p>I need to fill an array with a fixed pattern number sequence such as every x number of an element needs to add 1. </p>
  
  <p>I tried to use <code>for to step</code>, as in:</p>
  
  <pre><code>Option Explicit
  Sub Test_Array()
      Dim Myarray(1 To 10) As Double
      Dim Element As Double
      Dim i As Long
      i = 1
      For Element = LBound(Myarray) To UBound(Myarray) Step 2
          Myarray(Element) = i
          i = i + 1
      Next Element    
  End Sub 
  </code></pre>
  
  <p>The result is as follows:</p>
  
  <pre><code>Myarray=[1,0,2,0,3,0,4,0,5,0]
  </code></pre>
  
  <p>But between each step needs to be populated with the previous element as the next example:</p>
  
  <pre><code>Myarray=[1,1,2,2,3,3,4,4,5,5]
  </code></pre>
  
  <p>I don't know if <code>for to step</code> is the best choise.</p>