Add a trailing comma

  • Thread starter Thread starter Dimitry
  • Start date Start date
D

Dimitry

I need to add a trailing comma to a number. I have a
column with a few thousands rows in it, and I need to add
a comma to each number. I need to use this numbers in the
SQL statement, and they need to be separated by commas.
Any idea how to add a trailing comma?
 
May not be the fastest but
Sub addtrailingcomma()
For Each c In [c2:c4000]
c.Value = c & ","
Next
End Sub
 
If A1 is: 234 . . .

Then type: =(A1&",") in B1

and B1 will result in: 234,

Just copy that formula down to the bottom of your sheet and all value
will then be trailed by a comma. Once you copy the formula down to th
end you can then copy the entire B column and paste only the values i
a 3rd column.

Kevi
 
Hi Dimitry,
Is there a problem with Save As, .CSV
save your file first then do the save as.

Another solution would be Chip Pearson's page
Exporting to Text file (found in topic.htm)
http://www.cpearson.com/excel/imptext.htm#Export

To answer the question in the manner you asked you
would add a comma to you existing format under
Format, Cells, Custom. Needless to say the comma
you introduce is probably going to be indistinguishable from
your thousands separator, or possibly indistinguishable from
your list separator..

change #,##0
to #,##0","
 
Back
Top