View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Consolidating Data from Columns into Rows


Sub lineupintorows()
On Error Resume Next
For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1

If Cells(i + 1, 1) = Cells(i, 1) Then

For j = 2 To Cells(i + 1, 1).End(xlToRight).Column
lc = Cells(i, 1).End(xlToRight).Column + 1
Cells(i, lc) = Cells(i + 1, j)
Next j
Rows(i + 1).Delete

End If

Next i
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike" wrote in message
...
I need an efficient way to considate data from columns (i.e. 2 and 3) into
rows based on column 1.

For example:

Column 1 Column 2 Column 3 Column 4 Column 5
AAAA 1A1A1 1111
AAAA 2A2A2 2222
BBBB 1B1B1 1111

INTO

AAAA 1A1A1 1111 2A2A2 2222
BBBB 1B1B1 1111

The purpose is to consolidate the data into rows for email blasts (through
Word mail merge). Otherwise, users receive multiple emails for various
data.

Any suggestions?