Hello,
I am trying to write code to store data in a column into an array, but the data is not set a static number of rows
I have numbers that represent when the data changes and when i need a new array. for example
column B starting in cells( 2,1) and then in columnM (2,13)
1 RNEW
1 ADJ
1 RNEW
2 RNEW
2 ADJ
2 RNEW
3 ADJ
3 RNEW
3 ADJ
So i would want the the first array to be
myarray(0) = RNEW
myarray(1) = ADJ
myarray(2) = RNEW
then have another array stored
for when column b changes to 2
Heres what i have so far just not sure how to structure it correctly.
I am trying to write code to store data in a column into an array, but the data is not set a static number of rows
I have numbers that represent when the data changes and when i need a new array. for example
column B starting in cells( 2,1) and then in columnM (2,13)
1 RNEW
1 ADJ
1 RNEW
2 RNEW
2 ADJ
2 RNEW
3 ADJ
3 RNEW
3 ADJ
So i would want the the first array to be
myarray(0) = RNEW
myarray(1) = ADJ
myarray(2) = RNEW
then have another array stored
for when column b changes to 2
Heres what i have so far just not sure how to structure it correctly.
Code:
Sub dynamicDataterms()
Dim wsDataInput As Worksheet
Set wsDataInput = ThisWorkbook.Worksheets("Data Input")
Dim myarray() As Integer
Dim xrow As Integer
Dim size As Integer
xrow = 1
size = 1
index = 0
ReDim myarray(size)
myarray(index) = wsDataInput.Cells(xrow + 1, 13).Value
If wsDataInput.Cells(xrow + 1, 2).Value <> wsDataInput.Cells(xrow, 2).Value Then
End If
size = size + 1
ReDim Preserve myarray(size)
index = index + 1
xrow = xrow + 1
End Sub