i am looking at someone else's vba excel code. they are doing ReDim Preserve dataMatrix(7, i) in both loops. what does this do?
also, it seems like the second loop just overwrites the data in the first, loop, is that correct?
Dim dataMatrix() As String
Worksheets.Item("ETS").Select
Do While Trim(Cells(r, 1)) <> ""
Debug.Print "The line: ", Trim(Cells(r, 1)), r
r = r + 1
dataMatrix(1, i) = Trim(Cells(r, 1)) ''file name
dataMatrix(2, i) = Trim(Cells(r, 2)) ''sample type
dataMatrix(3, i) = Trim(Cells(r, 3)) ''sample name
dataMatrix(4, i) = "ETS" ''
dataMatrix(5, i) = Trim(Cells(r, 5)) ''Response
dataMatrix(6, i) = Trim(Cells(r, 6)) ''ISTD Response
dataMatrix(7, i) = Trim(Cells(r, 10)) ''Calculated Conc
i = i + 1
ReDim Preserve dataMatrix(7, i)
Loop
r = 5
Worksheets.Item("ETG").Select
Do While Trim(Cells(r, 1)) <> ""
Debug.Print "The line: ", Trim(Cells(r, 1)), r
r = r + 1
dataMatrix(1, i) = Trim(Cells(r, 1)) ''file name
dataMatrix(2, i) = Trim(Cells(r, 2)) ''sample type
dataMatrix(3, i) = Trim(Cells(r, 3)) ''sample name
dataMatrix(4, i) = "ETG"
dataMatrix(5, i) = Trim(Cells(r, 5)) ''Response
dataMatrix(6, i) = Trim(Cells(r, 6)) ''ISTD Response
dataMatrix(7, i) = Trim(Cells(r, 10)) ''Calculated Conc
i = i + 1
ReDim Preserve dataMatrix(7, i)
Loop