I have a list of 36 subjects and their ages, and whether they are in the 'Control' or "Exposed" group. I am trying split this list into two based on what group they are in. The program accurately splits the groups, but only returns the last value (age of the last subject) in each group 18 times. I am pretty sure my issue is the two "For" loops back to back, but don't know how to fix it. Thank you in advance.
enter code here Dim myArrC(1 To 18) As Variant myArrC(18) = Array() Dim myArrE(1 To 18) As Variant myArrC(18) = Array() Dim Counter As Integer Dim i As Integer For Counter = 2 To 37 For i = 1 To 18 If Sheets("Participant Info").Cells(Counter, 5) = "Control" Then myArrC(i) = Sheets("Participant Info").Cells(Counter, 3).Value Else myArrE(i) = Sheets("Participant Info").Cells(Counter, 3).Value End If Next i Next Counter Dim COunter2 As Integer For COunter2 = 1 To 18 MsgBox (myArrC(COunter2)) MsgBox (myArrE(COunter2)) Next COunter2 End Sub