Can I speed this simple routine up?

EssKayKay

Active Member
Joined
Jan 5, 2003
Messages
407
Office Version
  1. 2007
Platform
  1. Windows
Hello,
I have a sub that is doing what I want. However, it takes quite a while to run (15+ seconds).
No biggie here - I was wondering if there is something I could do to speed this up a bit.

Here is my code:
VBA Code:
Sub MinData()
Application.ScreenUpdating = False
Application.EnableEvents = False
   Range(Range("T14").Value & ":" & Range("T13").Value + 2).Delete Shift:=xlUp
End Sub

The delete range varies (T14 could be as high as row 2000 albeit doubtful).
In my test example -
T13 = 185
T14 = 386

Thanks for viewing,
Steve K.
 
If you delete a row manually, how long does it take for the workbook to recalculate and be ready again?
It takes about the same time. I may have found something. I reset the worksheet which utilizes the MinDATA sub. I then saved the file with no data - just all code
If you delete a row manually, how long does it take for the workbook to recalculate and be ready again?

Yes Rory I tried that - it takes about the same time. I may have found something though. I reset the worksheet which utilizes the MinDATA sub which clears out all the old data and prepares the workbook for new entries.

I then exported all the modules, forms etc., deleted them from the workbook, and saved the file with basically nothing in it except for labels, textboxes, combo boxes, lines, etc. I then reopened the file and imported all the exported items and saved it. Next, opened the file and re-entered all the data (hopefully identical to what was there) and saved. Finally, I ran the routine including the MinData and all worked much better. I have no idea what changed.

I’ve seen things like this happen before where apparently some little thing causes the routine(s) to run slow.

Thanks again,
Steve
 
Upvote 0

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,223,882
Messages
6,175,165
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top