Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Clearcontents takes long, long, time

I have some very simple code:

With Workbooks("Barcoded_Inv_2007_07.xlsm").Sheets("Raw _Data")

..Range("A3:AA50000").ClearContents

End With

This code has been running over ten minutes and has maxed out the
processor. Ctrl-break will not stop it. Automatic calculation is
turned off.

There is data in A3:AA:XXXXX

I just need to erase all the formulas and values in that range so I
can write new data there.

Thanks,

Brent

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Clearcontents takes long, long, time

Hi Fid

Set Calculation to manual before you run the code line

Application.Calculation = xlCalculationManual

And after that set it back

Application.Calculation =xlCalculationAutomatic


Do you have Event code also in the workbook ?
Then disable this also when you run your code



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Fid" wrote in message ups.com...
I have some very simple code:

With Workbooks("Barcoded_Inv_2007_07.xlsm").Sheets("Raw _Data")

.Range("A3:AA50000").ClearContents

End With

This code has been running over ten minutes and has maxed out the
processor. Ctrl-break will not stop it. Automatic calculation is
turned off.

There is data in A3:AA:XXXXX

I just need to erase all the formulas and values in that range so I
can write new data there.

Thanks,

Brent

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Clearcontents takes long, long, time

Is there data all the way to row 50000? If not, you may want to
change it to less than 50000. depending on your processor, memory and
apps you have running it may hang that long. Try this

Sub Macro1()
Range("A3:AA50000").Select
Range("AA50000").Activate
Selection.ClearContents
End Sub

On Aug 14, 3:26 pm, Fid wrote:
I have some very simple code:

With Workbooks("Barcoded_Inv_2007_07.xlsm").Sheets("Raw _Data")

.Range("A3:AA50000").ClearContents

End With

This code has been running over ten minutes and has maxed out the
processor. Ctrl-break will not stop it. Automatic calculation is
turned off.

There is data in A3:AA:XXXXX

I just need to erase all the formulas and values in that range so I
can write new data there.

Thanks,

Brent



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Clearcontents takes long, long, time

Check your other thread, too.

Fid wrote:

I have some very simple code:

With Workbooks("Barcoded_Inv_2007_07.xlsm").Sheets("Raw _Data")

.Range("A3:AA50000").ClearContents

End With

This code has been running over ten minutes and has maxed out the
processor. Ctrl-break will not stop it. Automatic calculation is
turned off.

There is data in A3:AA:XXXXX

I just need to erase all the formulas and values in that range so I
can write new data there.

Thanks,

Brent


--

Dave Peterson
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
Clearing cells takes long, long time unclemuffin Excel Discussion (Misc queries) 9 August 17th 07 02:22 AM
how do i add time to see how long my macro takes to run ernestgoh[_6_] Excel Programming 2 July 16th 06 11:05 AM
Excel Help takes a very long time to load Sam Pack via OfficeKB.com Excel Discussion (Misc queries) 4 March 4th 06 12:02 AM
Save takes long time Jan Excel Discussion (Misc queries) 2 February 15th 06 06:01 PM
Saving Takes long time kvenku[_6_] Excel Programming 1 May 14th 04 02:38 PM


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