Thread: merge text
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tim Williams Tim Williams is offline
external usenet poster
 
Posts: 1,588
Default 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