Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Help with getting rid of unused cells or ranges

Windows 2k Pro
Excel 2000

I have a macro that I wrote that compares two lists of data. One of the
options allows the user to run the macro again (as often as they like). The
lists that the user will be comparing can be of any size, from 100 rows of
values to 40,000 or more rows of values (up to the magical 65,536 of
course). I also gave the user the option to save the Results worksheet as a
CSV file. One of the things I noticed during testing was that the saved CSV
files were larger than I had thought they would be. I discovered that if on
the previous macro run that the lists were larger than the lists on the
current run, then those rows were being saved by the Save procedure, as
evidenced by the many many rows of commas at the end of the actual saved
data in the CSV file. I believe this is an issue of "used" Ranges, no?

I have incorporated some format procedures in my code, but unfortunately I
didn't allow for the above mentioned possibility.

Is it possible to incorporate a procedure within my Save procedure that will
re-set the "used" Range on my Results worksheet?

The way I see it I can either copy and paste only the range containing
results and save that, or I can delete all the unnecessary rows from the
Results worksheet and copy, paste and save that worksheet. Am I on the
right track?

If I go with the first option, then I have to find the last row containing a
non-blank value, which, for the sake of argument, could be in one of five
non-contiguous columns. I would then have to be able to select the range
from A1 to K??, with ?? being the row number which contains the last
non-blank value.

Any help in the right direction would be greatly appreciated.

-gk-


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Help with getting rid of unused cells or ranges

The statement:

ActiveSheet.UsedRange

by itself will reset the active area to the last cell with something in it
(contents, formatting, comment). Maybe using that after a ClearContents
will help.

--
Jim Rech
Excel MVP


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
How do i remove unused cells in excel? the_melstar Excel Worksheet Functions 1 March 29th 07 04:14 AM
what to do with unused cells B Excel Worksheet Functions 1 June 22nd 06 12:09 AM
deleting unused cells / getting rid of inactive cells Woody13 Excel Discussion (Misc queries) 3 January 26th 06 09:11 PM
Is there a way to cut off unused cells on a sheet newbie Excel Discussion (Misc queries) 2 August 3rd 05 06:13 PM
how get rid of cells with unused formulas Benj Excel Discussion (Misc queries) 3 July 8th 05 02:47 PM


All times are GMT +1. The time now is 01:05 AM.

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

About Us

"It's about Microsoft Excel"