Dim array_ofPairs() As Integer ' global
.....
k = 0 ' price
w = 0 ' number of consecutive appearances of certain price
z = 0 ' "price" column increment (1 down)
r = 0 ' counter
m = ActiveSheet.Range("Y2").Value ' total number of numerical data _ in "price" column
For t = 1 To m
k = ActiveSheet.Cells(7 + z, 5).Value
w = w + 1
z = z + 1
If k <> ActiveSheet.Cells(7 + z, 5).Value Then ' only if the next value is different
ReDim Preserve array_ofPairs(2, t)
array_ofPairs(0, r) = k
array_ofPairs(1, r) = w
w = 0
r = r + 1
End If
Next t
s = r - 1 'this is the counter which i solved the problem with, so i know how many pairs "price/numberofconsecutiveappearances" i have
MsgBox "array_ofPairs(0,0) = " & array_ofPairs(0, 0)
MsgBox "array_ofPairs(1,0) = " & array_ofPairs(1, 0)
MsgBox "array_ofPairs(0,1) = " & array_ofPairs(0, 1)
MsgBox "array_ofPairs(1,1) = " & array_ofPairs(1, 1)
MsgBox "array_ofPairs(0,2) = " & array_ofPairs(0, 2)
MsgBox "array_ofPairs(1,2) = " & array_ofPairs(1, 2)
MsgBox "array_ofPairs(0,3) = " & array_ofPairs(0, 3)
MsgBox "array_ofPairs(1,3) = " & array_ofPairs(1, 3)
MsgBox "UBound(array_ofPairs, 2) = " & UBound(array_ofPairs, 2)
.......