Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Concatenate rows

I need to concatenate rows of a large excel file. This type of data I
recieve every week and need help finding a macro that would fix my
files. I am a baby when it comes programming ;)

What I have:
Name Description
a r
a s
b t
b u
c v
c w

What I need:
Name Description
a r, s
b t, u
c v, w

I would really appreciate any help,
DD

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Concatenate rows

If your data is already sorted by column A:

Option Explicit
Sub testme()

Dim LastRow As Long
Dim FirstRow As Long
Dim iRow As Long
Dim wks As Worksheet

Set wks = Worksheets("sheet1")

With wks
FirstRow = 2 'headers in row 1??
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row

For iRow = LastRow To FirstRow + 1 Step -1
If .Cells(iRow, "A").Value = .Cells(iRow - 1, "A").Value Then
.Cells(iRow - 1, "B").Value _
= .Cells(iRow - 1, "B").Value & ", " & .Cells(iRow, "B").Value
.Rows(iRow).Delete
End If
Next iRow
End With

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

DD wrote:

I need to concatenate rows of a large excel file. This type of data I
recieve every week and need help finding a macro that would fix my
files. I am a baby when it comes programming ;)

What I have:
Name Description
a r
a s
b t
b u
c v
c w

What I need:
Name Description
a r, s
b t, u
c v, w

I would really appreciate any help,
DD


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Concatenate rows

Thank you! I'll give this a try...
DD

Reply
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
Concatenate 2 rows Mustang Excel Discussion (Misc queries) 2 September 17th 09 01:06 AM
Concatenate Multiple Rows Shamoun Ilyas Excel Discussion (Misc queries) 5 March 30th 09 11:48 AM
How to concatenate many rows in Excel Christina Haney Excel Worksheet Functions 3 January 17th 09 02:10 PM
Concatenate several rows Fuzzy Excel Worksheet Functions 4 April 23rd 08 02:06 PM
Concatenate many rows quickly [email protected] Excel Worksheet Functions 5 March 31st 08 12:09 AM


All times are GMT +1. The time now is 03:55 PM.

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"