View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Brian Taylor Brian Taylor is offline
external usenet poster
 
Posts: 52
Default Excel bombs out in macro...help please!!

I think your main resource drain is when you delete 40,000 lines:

Rows("7:40000").Select
Selection.Delete Shift:=xlUp

As a side thought you can make your code more efficient by removing the
select statements (vba doesn't need them since it isn't a user)

Rows("7:40000").Delete Shift:=xlUp

You should use this line instead:

Rows("7:40000").ClearContents

Deleting a lot of rows takes a while. Also you probably should turn
the calculation off and then on again when you are done:

Application.calculation = xlManual

code.....

Application.calculation = xlAutomatic