View Single Post
  #5   Report Post  
JPW
 
Posts: n/a
Default

Are you looking for an explanation of what the code is doing? Did you try
using this code to see if it meets your needs?

"JEFF" wrote in message
...
Beautiful! Any chance you could walk me through the code?

"JPW" wrote:

You can't do this easily with formulas, there is no real way to do
recursive
functions... it can be done very easily with a VBA function, but if
you're
afraid of VBA that won't work. :)

If not... hit ALT-F11 to access your VBA editor. In the upper-left, there
is
a list of objects in your workbook. RIGHT-Click on the very top object,
which says something like "VBAProject (Book1)" and choose "Insert -
Module"
.... this will add a folder down below that says Modules, and give you a
blank white screen. At this point the title bar should have "[Module1
(Code)]" at the end of its title. You're in the right place!

Next, copy and paste everything between the --'s into the empty window:
----------
Public Function TextConcat(cCells As Range) As String

Dim cCell As Range
Dim cString As String

For Each cCell In cCells
cString = cString & cCell.Text
Next cCell

TextConcat = cString

End Function
----------

Close your VBA editor window and you're back on your worksheet. Go to the
cell where you want your concatenated data, and use your newly created
function: =textconcat(A1:A9) ...etc. :) The only side-effect is the macro
warning when you open the file, but there are other ways to get around
that,
see other posts in the excel.programming newsgroup.


"JEFF" wrote in message
...
I have a column of data ("Original") that I added a comma to in the
adjoining
column:


Original Added Comma

I6680 I6680,
M1121 M1121,
B0265 B0265,
E0003 E0003,
X6126 X6126,
M2686 M2686,

I would like to have a single cell look like this:
I6680,M1121,B0265,E0003,X6126,M2686.......

I have have successfully done this by =B1&B2&B3&B4&B5&B6&B7&B9&B10...

Is there an easier way than having to manually typing that formula???


TIA!