Clearcontents takes long, long, time

  • Thread starter Thread starter Fid
  • Start date Start date
F

Fid

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
 
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
 
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
 
Check your other thread, too.
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top