#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 80
Default Column to text

Hello,

I'm looking for an easy/automated way to take care of the following:
I have single columns of varying size (meaning number of values in the
column) that I need to arrange into a single cell with the values separated
by commas.
E.g.
111
222
333
....
needs to be turned into 111,222,333,...
These columns can contain from 2 to a few hundred values. Obviously, it
would be easy to do this by hand for 2 values, but as the number of values
grows, this becomes tedious and error-prone.
Any suggestions would be greatly appreciated.

Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Column to text

First select the set of cells you want to process and then run:

Sub merge_them()
Set dest = Application.InputBox(prompt:="click on the destination cell",
Type:=8)
v = ""
For Each r In Selection
v = v & r.Value & ","
Next
dest.Value = Left(v, Len(v) - 1)
End Sub

The macro will ask you to pick the destination cell.
--
Gary''s Student - gsnu200795


"Niniel" wrote:

Hello,

I'm looking for an easy/automated way to take care of the following:
I have single columns of varying size (meaning number of values in the
column) that I need to arrange into a single cell with the values separated
by commas.
E.g.
111
222
333
...
needs to be turned into 111,222,333,...
These columns can contain from 2 to a few hundred values. Obviously, it
would be easy to do this by hand for 2 values, but as the number of values
grows, this becomes tedious and error-prone.
Any suggestions would be greatly appreciated.

Thank you.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 80
Default Column to text

Thanks a lot, that works beautifully.
Had to make sure though that
"Set dest = Application.InputBox(prompt:="click on the destination cell",
Type:=8)"
was all in one row, otherwise I got a syntax error.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
COUNTIF: 2 criteria: Date Range Column & Text Column MAC Excel Worksheet Functions 14 September 16th 08 04:39 PM
Return text in Column A if Column B and Column K match jeannie v Excel Worksheet Functions 4 December 13th 07 07:36 PM
To copy values in a column relevant to text in an adjacent column? Guy Keon Excel Worksheet Functions 2 November 15th 05 08:10 PM
Wrap text in column headers to fit text in column MarkN Excel Discussion (Misc queries) 10 November 11th 05 04:21 AM
How I can print full text bigger than column, in repeat column Prince Excel Discussion (Misc queries) 0 August 11th 05 07:28 PM


All times are GMT +1. The time now is 03:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"