merging cells/data using a Macro

G

Guest

I have a 6,000-line macro. At a certain point, I need to merge data from
various cells into other cells.

I want to merge (append?) data/text from cells B1 and C1 onto existing text
in A1 but then delete B1 and C1 so that A1 "stretches" across that range
(A1:C1). I never know what the actual data/text will be in the cells, though.

So, let's say that:
A1 contains the words "I like"
B1 contains the words "chocolate" and
C1 contains the words "ice cream."

I want to end up with "I like chocolate ice cream" in Cell A1 and, in
effect, delete the text in B1 and C1 so that A1's text "carries over" into
those cells. Or, after joining (?) the data, merge A1, B1, and C1.

Of course, I can do it manually and "record a macro" but it records the
actual words but that won't work in real life because the words/text are
always different.

Thanks, in advance.

Dan
 
A

Andibevan

Look at the text function concatenate - this can be used to link any number
of cells together in a contigiuos string

I have a 6,000-line macro. At a certain point, I need to merge data from
various cells into other cells.

I want to merge (append?) data/text from cells B1 and C1 onto existing text
in A1 but then delete B1 and C1 so that A1 "stretches" across that range
(A1:C1). I never know what the actual data/text will be in the cells,
though.

So, let's say that:
A1 contains the words "I like"
B1 contains the words "chocolate" and
C1 contains the words "ice cream."

I want to end up with "I like chocolate ice cream" in Cell A1 and, in
effect, delete the text in B1 and C1 so that A1's text "carries over" into
those cells. Or, after joining (?) the data, merge A1, B1, and C1.

Of course, I can do it manually and "record a macro" but it records the
actual words but that won't work in real life because the words/text are
always different.

Thanks, in advance.

Dan
 
G

Guest

Sorry for taking up bandwith but, omigod, thanks Andi, that's awesome. Works
perfectly! Shame on me for not knowing that. Thanks a lot!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top