Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default SaveAs Method adding a large number of comma-delimited blank lines


Hi all,


I am having a problem using the Save As Method using the
fileformat xlCSV (I have also tried xlcsvmsdos & xltextmsdos).

Here is a snippet of the code :

dim l1 as Long

With Worksheets("xyz")
l1 = .Cells(.Rows.Count, "A").End(xlUp).Row
End With

[l1 returns the correct line count and a print preview also correctly
prints only those rows].


Worksheets("xyz").SaveAs Filename:= _
"C:\My Documents\xyz", FileFormat:=xlCSV

After this command, I get the correct data PLUS I would guess about a
1000 lines of data that looks like this :
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,


Anyone seen anything like this, and, even better, is there a way to
prevent it happening ?

Thanks in advance,

Niall Heelan

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default SaveAs Method adding a large number of comma-delimited blank lines

How about adding this line of code to your macro

Rows((l1 + 1) & ":" & rows.Count).delete

" wrote:


Hi all,


I am having a problem using the Save As Method using the
fileformat xlCSV (I have also tried xlcsvmsdos & xltextmsdos).

Here is a snippet of the code :

dim l1 as Long

With Worksheets("xyz")
l1 = .Cells(.Rows.Count, "A").End(xlUp).Row
End With

[l1 returns the correct line count and a print preview also correctly
prints only those rows].


Worksheets("xyz").SaveAs Filename:= _
"C:\My Documents\xyz", FileFormat:=xlCSV

After this command, I get the correct data PLUS I would guess about a
1000 lines of data that looks like this :
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,


Anyone seen anything like this, and, even better, is there a way to
prevent it happening ?

Thanks in advance,

Niall Heelan


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default SaveAs Method adding a large number of comma-delimited blank lines

On Oct 19, 3:32 pm, Joel wrote:
How about adding this line of code to your macro

Rows((l1 + 1) & ":" & rows.Count).delete


Hi Joel,


Perfect.


Thanks again.

Niall
..

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VLookup Method for Comma Delimited Field DoveArrow Excel Discussion (Misc queries) 1 December 22nd 11 12:59 PM
Saving as tab delimited or comma delimited MathGrace Excel Discussion (Misc queries) 0 June 20th 08 08:02 PM
Comma Delimited-need comma at beginnng & end Tattoo Excel Discussion (Misc queries) 2 December 11th 07 04:39 PM
Totaling the number of comma delimited numbers in a column Glynn Furr Excel Worksheet Functions 3 April 12th 06 02:19 AM
Adding Items to a LISTBOX--eliminating Blank Lines jpendegraft[_8_] Excel Programming 2 May 1st 04 03:18 PM


All times are GMT +1. The time now is 03:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"