ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Clearcontents takes long, long, time (https://www.excelbanter.com/excel-programming/395486-clearcontents-takes-long-long-time.html)

Fid[_2_]

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


Ron de Bruin

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


KLZA

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




Dave Peterson

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


All times are GMT +1. The time now is 11:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com