Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Setup / June 2007

Tip: Looking for answers? Try searching our database.

How do I add a comma between a range of cells?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AZ ChrisD - 19 Jun 2007 23:03 GMT
Example: I have cells A1 through A70 with data in each cell in the following
format 123-03-123. I need a sting of text returned that will combine the
cells separated by a comma.

Example: 123-34-234,234-23-234,345-23-123, etc...

I need to be able to copy and paste the string in to a websearch that
specifies "separated by commas no spaces"

I know there has to be a simple way to do that but I am a rookie in Excel :(

Thanks for all your help...

Chris
Gord Dibben - 20 Jun 2007 01:58 GMT
With 70 cells I would use a user defined function.

Function ConCatRange(CellBlock As Range) As String
Dim cell As Range
Dim sbuf As String
   For Each cell In CellBlock
       If Len(cell.text) > 0 Then sbuf = sbuf & cell.text & ","
   Next
   ConCatRange = Left(sbuf, Len(sbuf) - 1)
End Function

After concatenating the range using  =ConCatRange(A1:A70)

copy/paste special>values.

Gord Dibben  MS Excel MVP

>Example: I have cells A1 through A70 with data in each cell in the following
>format 123-03-123. I need a sting of text returned that will combine the
[quoted text clipped - 10 lines]
>
>Chris
AZ ChrisD - 20 Jun 2007 17:45 GMT
That did it...

Thanks a bunch

> With 70 cells I would use a user defined function.
>
[quoted text clipped - 27 lines]
> >
> >Chris
Gord Dibben - 20 Jun 2007 18:19 GMT
Good to hear.

Thanks for the feedback.

>That did it...
>
[quoted text clipped - 31 lines]
>> >
>> >Chris
Roger Govier - 20 Jun 2007 01:59 GMT
Hi

assuming the concatenated string is in A1
=SUBSTITUTE(A1,"-",",")

Signature

Regards

Roger Govier

> Example: I have cells A1 through A70 with data in each cell in the
> following
[quoted text clipped - 13 lines]
>
> Chris
Roger Govier - 20 Jun 2007 07:38 GMT
Ignore that.
I totally misread your question.

Signature

Regards

Roger Govier

> Hi
>
[quoted text clipped - 18 lines]
>>
>> Chris
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.