ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   column list (https://www.excelbanter.com/excel-discussion-misc-queries/17884-column-list.html)

jose vargas

column list
 
can someone help? i need to export a list to a word-
wrapped with commas text document

My spreadsheet has 500 such numbers:

Column A
4567
45676
23434
442344

desired outpu:
4567,45676,23434,442344

Thanks

Peter Rooney

Hi, Jose!

Try this - you'll need to select the cells in your worksheet first, and
obviously subsitute an appropriate path and filename in the save as line

Hope this helps

Pete

Sub ListToTest()
Dim ListCounter As Integer
Dim ConCatString As String
ConCatString = ""
For ListCounter = 1 To Selection.Cells.Count
ConCatString = ConCatString & CStr(Selection.Cells(ListCounter)) & ","
Next ListCounter
Workbooks.Add
Range("A1").Formula = ConCatString
ActiveWorkbook.SaveAs Filename:="D:\Pete's Operations\VBA\Example.csv", _
FileFormat:=xlCSV, CreateBackup:=False
ActiveWorkbook.Close
End Sub


"jose vargas" wrote:

can someone help? i need to export a list to a word-
wrapped with commas text document

My spreadsheet has 500 such numbers:

Column A
4567
45676
23434
442344

desired outpu:
4567,45676,23434,442344

Thanks



All times are GMT +1. The time now is 12:43 AM.

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