I am trying to use offset in the 1d array to get the correct item or element inside the 1d array
Code: Select all
Sub Test()
Dim a, x
a = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
Dim start As Integer
start = Application.Match(6, a, 0)
x = 7
'How can I get the next item in the array offseting by x
'start would be here equal to 6, so if we offset by x which is 7
'we would go to the last item in the array which is 12
Debug.Print "X = " & a(11)
x = 9
'How can I get the next item in the array offseting by x
'start would be here equal to 6, so if we offset by x which is 9
'we would go to the second item in the array which is 2
Debug.Print "X = " & a(1)
End Sub