LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Merging Rows

I am trying to merge data in several columns to one row, for example.

Col 'A' Col 'B' Col 'C' Col 'D' Col 'E'
Joe 10/1/08
Joe 10/2/08
Joe 10/3/08
Kim 10/2/08
Kim 10/1/08
John 10/1/08
John 10/2/08
John 10/3/08
John 10/4/08

The Output should look like this:

Col 'A' Col 'B' Col 'C' Col 'D' Col 'E'
Joe 10/1/08 10/2/08 10/3/08

Kim 10/1/08 10/2/08
John 10/1/08 10/2/08 10/3/08 10/4/08


I have the following macro but it does not seem to work completely right. It
does some merging but leaves some duplicate names - wondered if anyone could
help?

Sub Remove_Duplicate()

Dim LASTROW As Long
Dim I As Long
Dim J As Long
Dim K As Long
Dim MyVALUE As Variant

Application.ScreenUpdating = False
LASTROW = Range("A" & Rows.Count).End(xlUp).Row
For I = 1 To LASTROW - 1
MyVALUE = Cells(I, "C") & Cells(I, "D")
For J = I + 1 To LASTROW
If (MyVALUE = Cells(J, "D") & Cells(J, "E")) Then
For K = 1 To 13
If (Cells(I, K) = "") Then Cells(I, K) = Cells(J, K)
Next K
Cells(J, "A").EntireRow.Delete
End If
Next J
Next I
Application.ScreenUpdating = True
'
End Sub
--
Jake
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Merging rows JakeShipley2008 Excel Programming 2 October 17th 08 05:44 PM
Is merging rows possible? Mr BT[_2_] Excel Worksheet Functions 1 May 16th 08 04:28 PM
Merging rows Peter Horrocks New Users to Excel 1 November 15th 05 12:01 PM
Merging Two Rows Into One Ourania Excel Worksheet Functions 1 March 18th 05 10:07 AM
Merging a number of rows Smeesh Excel Programming 1 May 4th 04 12:56 PM


All times are GMT +1. The time now is 08:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"