Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Saving worksheet as CSV with correct usedrange...

Hi all.

I have sheet(1) which begins filled with data to row 65000... This data is
sorted / filtered, copied to Sheet(2)... at this point, sheet(2) contains 400
rows of data only...
Sheet(1) is cleared (usedrange fix also applied for good measure)...

ie.

sheets(1).usedrange.clearcontents
x = sheets(1).usedrange.rows.count

Sheet(2) is copied back to Sheet(1)... Using the LastRow() function, this
correctly shows that lastrow is 400, as does usedrange. CTRL+END jumps to row
65000... even if I delete rows 401:65000, CTRL+END still jumps to same place.
I use VBA to save the worksheet as a CSV file, and the resultant CSV is
huge, with empty rows to 65000... if I open it and just re-save it, it
correctly saves as 400 rows only...

My question is - is there a means to save this as a CSV with only 400 lines
(without a manual row-by-row parsing) without having to re-save it to reset
the empty row issue ??

TIA
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default Saving worksheet as CSV with correct usedrange...

On Nov 13, 1:07 pm, Mike Iacovou
wrote:
Hi all.

I have sheet(1) which begins filled with data to row 65000... This data is
sorted / filtered, copied to Sheet(2)... at this point, sheet(2) contains 400
rows of data only...
Sheet(1) is cleared (usedrange fix also applied for good measure)...

ie.

sheets(1).usedrange.clearcontents
x = sheets(1).usedrange.rows.count

Sheet(2) is copied back to Sheet(1)... Using the LastRow() function, this
correctly shows that lastrow is 400, as does usedrange. CTRL+END jumps to row
65000... even if I delete rows 401:65000, CTRL+END still jumps to same place.
I use VBA to save the worksheet as a CSV file, and the resultant CSV is
huge, with empty rows to 65000... if I open it and just re-save it, it
correctly saves as 400 rows only...

My question is - is there a means to save this as a CSV with only 400 lines
(without a manual row-by-row parsing) without having to re-save it to reset
the empty row issue ??

TIA


Hello Mike,
Have a look at this article. It is simple and works well.

http://articles.techrepublic.com.com...1-6135485.html

Sincerely,
Leith Ross

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
Why is worksheet.usedrange empty? Sara Excel Worksheet Functions 2 August 24th 07 03:38 PM
How to get print area borders - UsedRange not correct. JO Excel Programming 1 March 3rd 06 06:37 PM
working with the correct worksheet [email protected] Excel Programming 2 September 2nd 05 12:39 AM
activating correct worksheet Robert Christie[_3_] Excel Programming 6 February 14th 05 03:17 PM
Redefining the UsedRange of a Worksheet ExcelMonkey[_189_] Excel Programming 1 February 13th 05 06:34 PM


All times are GMT +1. The time now is 03:58 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"