title: VBA Array repetition
body: <p>I am trying to make a function that takes in 3 values, and outputs that many of three different numbers in array format (in this case 1,2,4). For example: EntryArray(1,2,1) would output vertically: 1,1,2,2,2,4,4. However, it should repeat this array a certain number of times (given as the last value), and this part I can't get to work. For example: EntryArray(2,1,1,4) should give:
  1,1,2,4,1,1,2,4,1,1,2,4,1,1,2,4</p>
  <p>My code as follows:</p>
  <pre><code>Function EntryArray(One As Integer, Two As Integer, Four As Integer, Rept As Integer) As Integer()
  
  Dim Length As Integer
  Length = One + Two + Four
  
  Dim entry() As Integer
  ReDim entry(0 To Length, 0)
  
  For i = 1 To Length
  entry(i, 0) = 1
  If i &gt; One Then entry(i, 0) = 2
  If i &gt; Two + One Then entry(i, 0) = 4
  Next i
  
  EntryArray = entry
  
  End Function
  </code></pre>