ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   merge text (https://www.excelbanter.com/excel-programming/372317-merge-text.html)

Reg

merge text
 
I have a spreadsheet that was created by another person.
They have broken sentences into individual cells
Sort
of
like
this

this continues for several hundred lines and I have to maintain it!

I've played with =concatenate and a couple of other things but what I really
nees is to figure out a macro that takes the current selection (say b1:b6)
and concatenates it into b1 (ie: b1 = b1&b2&b3&b4&b5&b6) - I know how to add
spaces etc but thats is a secondary concern.

The number of cells to add together is always different but they are always
in columns.

I have played with snippets of code and such and could probably make this
work if I had a couple of weeks to understand the model (I'm new to this -
did you guess?) but this must be something someone has come across before?


Can anyone point me at some code or ideas that will give me a jump start?

TIA

Greg

Tim Williams

merge text
 
function GetText(rng as range) as string

dim c as range, v as string

for each c in rng
if c.value<"" then v=v & iif(v="",""," ") & c.value
next c

GetText=v
end function

--
Tim Williams
Palo Alto, CA


"Reg" wrote in message ...
I have a spreadsheet that was created by another person.
They have broken sentences into individual cells
Sort
of
like
this

this continues for several hundred lines and I have to maintain it!

I've played with =concatenate and a couple of other things but what I really
nees is to figure out a macro that takes the current selection (say b1:b6)
and concatenates it into b1 (ie: b1 = b1&b2&b3&b4&b5&b6) - I know how to add
spaces etc but thats is a secondary concern.

The number of cells to add together is always different but they are always
in columns.

I have played with snippets of code and such and could probably make this
work if I had a couple of weeks to understand the model (I'm new to this -
did you guess?) but this must be something someone has come across before?


Can anyone point me at some code or ideas that will give me a jump start?

TIA

Greg





All times are GMT +1. The time now is 02:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com