Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I am using the following code to export data in excel file (muliple columns) to csv file sub Export_toCSV() ThisWorkbook.Sheets(1).Range("actlist").Select ' actlist is a named rage (3 columns) Selection.Copy Workbooks.Add Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ True, Transpose:=False Application.DisplayAlerts = False ActiveWorkbook.SaveAs Filename:=path, FileFormat:=xlCSVMSDOS, CreateBackup:=False ActiveWorkbook.Close Application.DisplayAlerts = True ThisBook.Activate ThisBook.Worksheets(1).Range("A1").Activate End sub() Here is what I am getting. 22900002,46002759, 22900003,46002776,22525548 22900040,46002806, 22995012,46002873,25658415 22995014,46002877, 22995103,46002982, 22995111,, 22995117,, 22995127 22995128 22995153 What I DON'T understand is why there are two commas put in for 22995111 & 22995127. (if the 3rd column does not have data, 1 comma put in for the same numbers) Also, why the comma is at the end for some rows but not for others. I need consistency. if the comma is put always, I need the comma even for the last column. OR the comma should not be there if there are no data on the next column. 22995012,46002873,25658415 22995014,46002877, Note: when I write to the file line by line with print statement its OK but the performance is very slow. Any help appreciated. Thanks in advance |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
export re-order input fields to export file [csv] | Excel Worksheet Functions | |||
Export txt file problem | Excel Programming | |||
How do I export data from Excel as a series of comma-separated val | New Users to Excel | |||
Export file problem for TXT file. | Excel Programming | |||
Excel How do I create a comma delineated xls file to a comma delineated. | Excel Discussion (Misc queries) |