Hi,
You can use an array to loop through and pick up the values and then write them to the next sheet:
Sub GetUnits()
Dim astrUnits(10) As String 'array to hold names and units
Dim intCount As Integer 'to keep track of place in array
Dim i As Integer 'loop counter
Dim j As Integer
Dim k As Integer
For j = 2 To 10
'set counter for astrUnits and student
intCount = 1
'get student name
astrUnits(0) = Cells(j, 1).Value
For i = 2 To 17
'get units picked
If Cells(j, i).Value = "E" Then
'add to array and increment counter
astrUnits(intCount) = Cells(1, i).Value
intCount = intCount + 1
End If
Next i
'now add to report sheet
ActiveSheet.Next.Select
For k = 0 To 10
Cells(j - 1, k + 1).Value = astrUnits(k)
Next k
ActiveSheet.Previous.Select
Next j
End Sub
Hope this helps!
!--removed tag-->
Enter your message below
Sign in or Join us (it's free).