PC Review


Reply
Thread Tools Rate Thread

ClearContents

 
 
=?Utf-8?B?UGF1bCBEZW5uaXM=?=
Guest
Posts: n/a
 
      10th Sep 2007
I have a sheet of data that I replace by importing data from another
workbook, however I need to clear out the original sheet since the data might
not use the same amount of rows.

My workbook is 18mb.

I can have 22000 rows to delete from column A to AE.

I have tried the following, all work, however they take an age to do:

ThisWorkbook.Sheets(data_type & " Data").Cells.ClearContents
or
ThisWorkbook.Sheets(data_type & " Data").Range("A1:AE22000").ClearContents
Note: This is a test and if it was quick then I would need to work out how
to change ("A1:AE22000") to use r instead of 22000 from below
r = .Range("A1").CurrentRegion.Rows.Count

Is there anyway of doing this quickly, i.e. something that take less than a
minute. Mine takes several minutes.


 
Reply With Quote
 
 
 
 
=?Utf-8?B?Y2Fyb2xpbmU=?=
Guest
Posts: n/a
 
      10th Sep 2007
try to set up the calculation to manual before deleting
and then reset it to automatic when finished
With Application
.Calculation = xlManual
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False


With Application
.Calculation = xlAutomatic
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False


--
caroline


"Paul Dennis" wrote:

> I have a sheet of data that I replace by importing data from another
> workbook, however I need to clear out the original sheet since the data might
> not use the same amount of rows.
>
> My workbook is 18mb.
>
> I can have 22000 rows to delete from column A to AE.
>
> I have tried the following, all work, however they take an age to do:
>
> ThisWorkbook.Sheets(data_type & " Data").Cells.ClearContents
> or
> ThisWorkbook.Sheets(data_type & " Data").Range("A1:AE22000").ClearContents
> Note: This is a test and if it was quick then I would need to work out how
> to change ("A1:AE22000") to use r instead of 22000 from below
> r = .Range("A1").CurrentRegion.Rows.Count
>
> Is there anyway of doing this quickly, i.e. something that take less than a
> minute. Mine takes several minutes.
>
>

 
Reply With Quote
 
=?Utf-8?B?UGF1bCBEZW5uaXM=?=
Guest
Posts: n/a
 
      11th Sep 2007
I have all calulations already turned off in my workbook and then force an
application recalc once all the new data is in.

"caroline" wrote:

> try to set up the calculation to manual before deleting
> and then reset it to automatic when finished
> With Application
> .Calculation = xlManual
> .MaxChange = 0.001
> End With
> ActiveWorkbook.PrecisionAsDisplayed = False
>
>
> With Application
> .Calculation = xlAutomatic
> .MaxChange = 0.001
> End With
> ActiveWorkbook.PrecisionAsDisplayed = False
>
>
> --
> caroline
>
>
> "Paul Dennis" wrote:
>
> > I have a sheet of data that I replace by importing data from another
> > workbook, however I need to clear out the original sheet since the data might
> > not use the same amount of rows.
> >
> > My workbook is 18mb.
> >
> > I can have 22000 rows to delete from column A to AE.
> >
> > I have tried the following, all work, however they take an age to do:
> >
> > ThisWorkbook.Sheets(data_type & " Data").Cells.ClearContents
> > or
> > ThisWorkbook.Sheets(data_type & " Data").Range("A1:AE22000").ClearContents
> > Note: This is a test and if it was quick then I would need to work out how
> > to change ("A1:AE22000") to use r instead of 22000 from below
> > r = .Range("A1").CurrentRegion.Rows.Count
> >
> > Is there anyway of doing this quickly, i.e. something that take less than a
> > minute. Mine takes several minutes.
> >
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error Help ClearContents millwalll Microsoft Excel Programming 3 3rd Apr 2008 04:22 PM
Clearcontents Caroline Vincent Microsoft Excel Programming 2 9th Sep 2004 11:03 AM
ClearContents - Except NamedRanges Mike Fogleman Microsoft Excel Programming 8 2nd Sep 2004 01:19 AM
Clearcontents K Dales Microsoft Excel Programming 0 27th Feb 2004 01:52 PM
Re: Clearcontents Dick Kusleika Microsoft Excel Programming 0 17th Feb 2004 05:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:39 PM.