I have a single row of data, which will grow, which I need to merge into a
long list of text in one cell, so I can paste into another program. I have
started with the concantenate function, but I could do with a function to
automatically go down the list until there is no more data. I think I have
seen this done, but I can't remember how.
TIA

Re: Merge multiple row data in one cell with delimieters by Don

Don
Sun May 11 08:23:55 CDT 2008

One way. Just make sure that there is an empty column between last data and
the column to fill. If putting data in col G then col F should be blank

Sub mergecolumndata()
mc = "a"
lr = Cells(Rows.Count, mc).End(xlUp).Row
For Each c In Range(Cells(2, mc), Cells(lr, mc))
lc = Cells(c.Row, mc).End(xlToRight).Column + 1
mystr = ""
For i = 1 To lc
mystr = mystr & Cells(c.Row, i) & ","
Next i
cells(c.Row, "g") = Left(mystr, Len(mystr) - 2)
Next c
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com
"Terryrubby" <Terryrubby@discussions.microsoft.com> wrote in message
news:4C099113-A9AA-4533-899A-50F13E02D8BF@microsoft.com...
>I have a single row of data, which will grow, which I need to merge into a
> long list of text in one cell, so I can paste into another program. I
> have
> started with the concantenate function, but I could do with a function to
> automatically go down the list until there is no more data. I think I
> have
> seen this done, but I can't remember how.
> TIA


Re: Merge multiple row data in one cell with delimieters by Terryrubby

Terryrubby
Sun May 11 10:06:01 CDT 2008

Thanks for the quick reply.

I have added this macro to a shape, but it comes up with an error 1004 and
highlights the mystr = mystr & Cells(c.Row, i) & "," line.

Was I supposed to add in some information? At the moment all my data is in
column a from row 1 to 29 if this helps.

"Don Guillett" wrote:

> One way. Just make sure that there is an empty column between last data and
> the column to fill. If putting data in col G then col F should be blank
>
> Sub mergecolumndata()
> mc = "a"
> lr = Cells(Rows.Count, mc).End(xlUp).Row
> For Each c In Range(Cells(2, mc), Cells(lr, mc))
> lc = Cells(c.Row, mc).End(xlToRight).Column + 1
> mystr = ""
> For i = 1 To lc
> mystr = mystr & Cells(c.Row, i) & ","
> Next i
> cells(c.Row, "g") = Left(mystr, Len(mystr) - 2)
> Next c
> End Sub
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> dguillett1@austin.rr.com
> "Terryrubby" <Terryrubby@discussions.microsoft.com> wrote in message
> news:4C099113-A9AA-4533-899A-50F13E02D8BF@microsoft.com...
> >I have a single row of data, which will grow, which I need to merge into a
> > long list of text in one cell, so I can paste into another program. I
> > have
> > started with the concantenate function, but I could do with a function to
> > automatically go down the list until there is no more data. I think I
> > have
> > seen this done, but I can't remember how.
> > TIA
>
>

Re: Merge multiple row data in one cell with delimieters by Don

Don
Sun May 11 10:29:57 CDT 2008


Since you didn't fully explain and you said "a single row of data", I
assumed you had info in columns a,b,c or a,b,c,d etc. and wanted to string
together into column G.
A B C D E F G
a b c BLANK a,b,c
a b c d BLANK a,b,c,d
a b c BLANK a,b,c
a b c d ff BLANK a,b,c,d,ff


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com
"Terryrubby" <Terryrubby@discussions.microsoft.com> wrote in message
news:FFEDCC2A-9054-48C4-9FB3-50D58A322516@microsoft.com...
> Thanks for the quick reply.
>
> I have added this macro to a shape, but it comes up with an error 1004 and
> highlights the mystr = mystr & Cells(c.Row, i) & "," line.
>
> Was I supposed to add in some information? At the moment all my data is
> in
> column a from row 1 to 29 if this helps.
>
> "Don Guillett" wrote:
>
>> One way. Just make sure that there is an empty column between last data
>> and
>> the column to fill. If putting data in col G then col F should be blank
>>
>> Sub mergecolumndata()
>> mc = "a"
>> lr = Cells(Rows.Count, mc).End(xlUp).Row
>> For Each c In Range(Cells(2, mc), Cells(lr, mc))
>> lc = Cells(c.Row, mc).End(xlToRight).Column + 1
>> mystr = ""
>> For i = 1 To lc
>> mystr = mystr & Cells(c.Row, i) & ","
>> Next i
>> cells(c.Row, "g") = Left(mystr, Len(mystr) - 2)
>> Next c
>> End Sub
>>
>> --
>> Don Guillett
>> Microsoft MVP Excel
>> SalesAid Software
>> dguillett1@austin.rr.com
>> "Terryrubby" <Terryrubby@discussions.microsoft.com> wrote in message
>> news:4C099113-A9AA-4533-899A-50F13E02D8BF@microsoft.com...
>> >I have a single row of data, which will grow, which I need to merge into
>> >a
>> > long list of text in one cell, so I can paste into another program. I
>> > have
>> > started with the concantenate function, but I could do with a function
>> > to
>> > automatically go down the list until there is no more data. I think I
>> > have
>> > seen this done, but I can't remember how.
>> > TIA
>>
>>


Re: Merge multiple row data in one cell with delimieters by Terryrubby

Terryrubby
Mon May 12 18:34:14 CDT 2008

Sorry Don,

I knew what I wanted to say but it came across wrong. If I understand what
you have written, can I substitute the the word column for row in certain
lines, if not all. I haven't had a chance to try it yet, but will give it a
go this evening

Re: Merge multiple row data in one cell with delimieters by Don

Don
Mon May 12 18:49:50 CDT 2008


I still do NOT understand your problem. Send you file to my address below if
you like.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com
"Terryrubby" <Terryrubby@discussions.microsoft.com> wrote in message
news:573B62EF-9B8B-4B5D-82BD-9E4F2EE5F42D@microsoft.com...
> Sorry Don,
>
> I knew what I wanted to say but it came across wrong. If I understand
> what
> you have written, can I substitute the the word column for row in certain
> lines, if not all. I haven't had a chance to try it yet, but will give it
> a
> go this evening


Re: Merge multiple row data in one cell with delimieters by Terryrubby

Terryrubby
Tue May 13 15:07:01 CDT 2008

Don,

I have emailed you the file

Thanks

"Don Guillett" wrote:

>
> I still do NOT understand your problem. Send you file to my address below if
> you like.
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> dguillett1@austin.rr.com
> "Terryrubby" <Terryrubby@discussions.microsoft.com> wrote in message
> news:573B62EF-9B8B-4B5D-82BD-9E4F2EE5F42D@microsoft.com...
> > Sorry Don,
> >
> > I knew what I wanted to say but it came across wrong. If I understand
> > what
> > you have written, can I substitute the the word column for row in certain
> > lines, if not all. I haven't had a chance to try it yet, but will give it
> > a
> > go this evening
>
>

Re: Merge multiple row data in one cell with delimieters by Don

Don
Tue May 13 16:03:25 CDT 2008

Makes all of col A into one cell.

Sub mergecolumndata()
mc = "a"
lr = Cells(Rows.Count, mc).End(xlUp).Row
For Each c In Range(Cells(1, mc), Cells(lr, mc))
mystr = mystr & c & ","
Next c
'MsgBox mystr
Cells(1, mc).Offset(, 1).Value = Left(mystr, Len(mystr) - 1)
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com
"Terryrubby" <Terryrubby@discussions.microsoft.com> wrote in message
news:4BF0B7E5-6A49-4177-9984-E320182CA8ED@microsoft.com...
> Don,
>
> I have emailed you the file
>
> Thanks
>
> "Don Guillett" wrote:
>
>>
>> I still do NOT understand your problem. Send you file to my address below
>> if
>> you like.
>>
>> --
>> Don Guillett
>> Microsoft MVP Excel
>> SalesAid Software
>> dguillett1@austin.rr.com
>> "Terryrubby" <Terryrubby@discussions.microsoft.com> wrote in message
>> news:573B62EF-9B8B-4B5D-82BD-9E4F2EE5F42D@microsoft.com...
>> > Sorry Don,
>> >
>> > I knew what I wanted to say but it came across wrong. If I understand
>> > what
>> > you have written, can I substitute the the word column for row in
>> > certain
>> > lines, if not all. I haven't had a chance to try it yet, but will give
>> > it
>> > a
>> > go this evening
>>
>>


Re: Merge multiple row data in one cell with delimieters by Terryrubby

Terryrubby
Tue May 13 17:33:00 CDT 2008

Many Thanks Don,

That worked a treat

"Don Guillett" wrote:

> Makes all of col A into one cell.
>
> Sub mergecolumndata()
> mc = "a"
> lr = Cells(Rows.Count, mc).End(xlUp).Row
> For Each c In Range(Cells(1, mc), Cells(lr, mc))
> mystr = mystr & c & ","
> Next c
> 'MsgBox mystr
> Cells(1, mc).Offset(, 1).Value = Left(mystr, Len(mystr) - 1)
> End Sub
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> dguillett1@austin.rr.com
> "Terryrubby" <Terryrubby@discussions.microsoft.com> wrote in message
> news:4BF0B7E5-6A49-4177-9984-E320182CA8ED@microsoft.com...
> > Don,
> >
> > I have emailed you the file
> >
> > Thanks
> >
> > "Don Guillett" wrote:
> >
> >>
> >> I still do NOT understand your problem. Send you file to my address below
> >> if
> >> you like.
> >>
> >> --
> >> Don Guillett
> >> Microsoft MVP Excel
> >> SalesAid Software
> >> dguillett1@austin.rr.com
> >> "Terryrubby" <Terryrubby@discussions.microsoft.com> wrote in message
> >> news:573B62EF-9B8B-4B5D-82BD-9E4F2EE5F42D@microsoft.com...
> >> > Sorry Don,
> >> >
> >> > I knew what I wanted to say but it came across wrong. If I understand
> >> > what
> >> > you have written, can I substitute the the word column for row in
> >> > certain
> >> > lines, if not all. I haven't had a chance to try it yet, but will give
> >> > it
> >> > a
> >> > go this evening
> >>
> >>
>
>

Re: Merge multiple row data in one cell with delimieters by Don

Don
Tue May 13 17:53:23 CDT 2008

Glad to help

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com
"Terryrubby" <Terryrubby@discussions.microsoft.com> wrote in message
news:29D6D006-7F93-45E2-8301-594FCA300A19@microsoft.com...
> Many Thanks Don,
>
> That worked a treat
>
> "Don Guillett" wrote:
>
>> Makes all of col A into one cell.
>>
>> Sub mergecolumndata()
>> mc = "a"
>> lr = Cells(Rows.Count, mc).End(xlUp).Row
>> For Each c In Range(Cells(1, mc), Cells(lr, mc))
>> mystr = mystr & c & ","
>> Next c
>> 'MsgBox mystr
>> Cells(1, mc).Offset(, 1).Value = Left(mystr, Len(mystr) - 1)
>> End Sub
>>
>> --
>> Don Guillett
>> Microsoft MVP Excel
>> SalesAid Software
>> dguillett1@austin.rr.com
>> "Terryrubby" <Terryrubby@discussions.microsoft.com> wrote in message
>> news:4BF0B7E5-6A49-4177-9984-E320182CA8ED@microsoft.com...
>> > Don,
>> >
>> > I have emailed you the file
>> >
>> > Thanks
>> >
>> > "Don Guillett" wrote:
>> >
>> >>
>> >> I still do NOT understand your problem. Send you file to my address
>> >> below
>> >> if
>> >> you like.
>> >>
>> >> --
>> >> Don Guillett
>> >> Microsoft MVP Excel
>> >> SalesAid Software
>> >> dguillett1@austin.rr.com
>> >> "Terryrubby" <Terryrubby@discussions.microsoft.com> wrote in message
>> >> news:573B62EF-9B8B-4B5D-82BD-9E4F2EE5F42D@microsoft.com...
>> >> > Sorry Don,
>> >> >
>> >> > I knew what I wanted to say but it came across wrong. If I
>> >> > understand
>> >> > what
>> >> > you have written, can I substitute the the word column for row in
>> >> > certain
>> >> > lines, if not all. I haven't had a chance to try it yet, but will
>> >> > give
>> >> > it
>> >> > a
>> >> > go this evening
>> >>
>> >>
>>
>>