I need to fill an array with a fixed pattern number sequence such as every x number of an element needs to add 1.
I tried to use for to step, as in:
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
The result is as follows:
Myarray=[1,0,2,0,3,0,4,0,5,0]
But between each step needs to be populated with the previous element as the next example:
Myarray=[1,1,2,2,3,3,4,4,5,5]
I don't know if for to step is the best choise.