ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Extra rows in csv file (https://www.excelbanter.com/excel-programming/303789-extra-rows-csv-file.html)

Kevin

Extra rows in csv file
 
When I save a worksheet as a .csv file via macro
(using "ActiveWorkbook.SaveAs FileNameString,
FileFormat:= xlCSV, CreateBackup:=False"), Excel seems to
add a large number of empty rows (all commas, no data) at
the bottom of the rows with data.

Any way to tell it how many rows to save, without the
rows of nulls?

Thanks in advance

kevin

Tom Ogilvy

Extra rows in csv file
 
do edit =goto = Special = Last Cell

do you end up well past your data. If so, you need to delete entire rows
below your last filled cell

set rng = cells(rows.count,1).End(xlup)
rows(rng.row+1 & ":65536").Delete
ActiveSheet.UsedRange
' now save the file

This assumes these rows are actually empty.

--
Regards,
Tom Ogilvy



"Kevin" wrote in message
...
When I save a worksheet as a .csv file via macro
(using "ActiveWorkbook.SaveAs FileNameString,
FileFormat:= xlCSV, CreateBackup:=False"), Excel seems to
add a large number of empty rows (all commas, no data) at
the bottom of the rows with data.

Any way to tell it how many rows to save, without the
rows of nulls?

Thanks in advance

kevin





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

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