# if student number repeats move all data for that number on to same

I

#### ILoveMyCorgi

In the first column I have a student number, the second column a currency
value, the third column a date, and the third column contains comments. The
next row may contain the same student number, with a different amount and
comment, and
so on until I get to the next student number and a new set amounts and
comments. Is there a way using visual basic where the one unique student
number displays with all of the currency amounts and corresponding comments
for that student in the same row? I am trying to do a merge and need all the
data on one row.

I have the VB below, but it doesn't work! Thanks for your help.

Sub newlist()
Set w1 = Sheets("Sheet1")
Set w2 = Sheets("Sheet2")
w2.Cells(1, 1).Value = w1.Cells(1, 1).Value
w2.Cells(1, 2).Value = w1.Cells(1, 2).Value
Ide = Cells(1, 1).Value
w1.Activate
n = Cells(Rows.Count, 1).End(xlUp).Row
k = 3
kk = 1
For i = 2 To n
If w1.Cells(i, 1).Value = Ide Then
w2.Cells(kk, k).Value = w1.Cells(i, 2).Value
k = k + 1
Else
kk = kk + 1
k = 3
Ide = w1.Cells(i, 1).Value
w2.Cells(kk, 1).Value = Ide
w2.Cells(kk, 2).Value = w1.Cells(i, 2).Value
End If
Next
End Sub

I

#### ILoveMyCorgi

I am sorry... i deleted the third column [the date] -- I have a total of
three columns. Thanks.