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
My code as follows:
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 > One Then entry(i, 0) = 2
If i > Two + One Then entry(i, 0) = 4
Next i
EntryArray = entry
End Function