Extra rows in csv file

K

Kevin

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
 
T

Tom Ogilvy

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top