ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   excel comma quote (https://www.excelbanter.com/excel-programming/343521-excel-comma-quote.html)

[email protected]

excel comma quote
 
Is there a way to select a column of ID numbers in an Excel (2002)
column and save it to a text file or clipboard with comma quote
delimiters?

0000031814
0000044857
0000015098
0000043186
0000111012
0000017184

becomes

"0000031814","0000044857","0000015098",
"0000043186","0000111012","0000017184"


Alok

excel comma quote
 
Hi,
One suggestion will be to do Edit/Copy and then Edit/PasteSpecial/Transpose.
This will help you transform the column of cells to a row of cells. Then
delete the column of cells and export to a CSV format. (This option is
available when you save the file by using Save As on an existing file.)
Unfortunately this will still not enclose the numbers in double quotes.
Alok

" wrote:

Is there a way to select a column of ID numbers in an Excel (2002)
column and save it to a text file or clipboard with comma quote
delimiters?

0000031814
0000044857
0000015098
0000043186
0000111012
0000017184

becomes

"0000031814","0000044857","0000015098",
"0000043186","0000111012","0000017184"



Cush

excel comma quote
 
Does this get you started:

Sub Test()
Dim i As Integer
Dim strList As String

For i = 1 To Range("MyRange").Count
strList = strList & """" & Range("MyRange")(i).Text & """, "

Next i
strList = Left(strList, Len(strList) - 2)
MsgBox strList
End Sub

I tested this on your short list and it produced the correct string.
However there may be a limit to the length of the string (max number of
characters)
Don't know if this will work for you.

" wrote:

Is there a way to select a column of ID numbers in an Excel (2002)
column and save it to a text file or clipboard with comma quote
delimiters?

0000031814
0000044857
0000015098
0000043186
0000111012
0000017184

becomes

"0000031814","0000044857","0000015098",
"0000043186","0000111012","0000017184"




All times are GMT +1. The time now is 11:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com