Extremely SLOW Code

mikebecker

Board Regular
Joined
Mar 28, 2004
Messages
227
Why on earth does this code run so slow. Even on a blank workbook.

Sub Selldown_Headers()
Range("C2") = "0 to 10%"
Range("C3") = "11 to 20%"
Range("C4") = "21 to 30%"
Range("C5") = "31 to 40%"
Range("C6") = "41 to 50%"
Range("C7") = "Target 51 to 65%"
Range("C8") = "66 to 70%"
Range("C9") = "71 to 80%"
Range("C10") = "81 to 90%"
Range("C11") = "91 to 100%"
End Sub
Sub Selldown_Formulas()
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Nimrod

MrExcel MVP
Joined
Apr 29, 2002
Messages
6,259
This code takes virtually no time to run on my system. Do you have alot of formula's that are being re-calculated in the workbook ? Turn you calculations to manual and see if that makes a difference.

This option is found under ..."Tools" ... "Options"... on the "Calculation Tab"
 

mikebecker

Board Regular
Joined
Mar 28, 2004
Messages
227
No Calculations.

I'll run this on a blank sheet and get the same.

I have even turned off most of my add-ins.
 

Nimrod

MrExcel MVP
Joined
Apr 29, 2002
Messages
6,259
Are any other macro's being triggered or run when these headings are be applied ?
 

PA HS Teacher

Well-known Member
Joined
Jul 17, 2004
Messages
2,838

ADVERTISEMENT

Is there a work sheet change event? Have you tried disabling Macros?
 

PA HS Teacher

Well-known Member
Joined
Jul 17, 2004
Messages
2,838

ADVERTISEMENT

Hello Nimrod, you are not confused, I am. In fact I think I may be running slower then the code in question.
[edit]

How about adding
Application.enableevents = false

Code


Applicaiton.enableevents = true
 

Tom Urtis

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,270
mikebecker said:
Why on earth does this code run so slow. Even on a blank workbook.
Just for the heck of it, reboot your computer, then create a new, fresh workbook, then name and save the workbook onto your hard drive (not a disk drive). Install this macro in it, and run it. Any better?


Sub Selldown_Headers()
With Application
Range("C2:C11").Value = _
.Transpose(Array( _
"0 to 10%", _
"11 to 20%", _
"21 to 30%", _
"31 to 40%", _
"41 to 50%", _
"Target 51 to 65%", _
"66 to 70%", _
"71 to 80%", _
"81 to 90%", _
"91 to 100%"))
End With
End Sub
 

mikebecker

Board Regular
Joined
Mar 28, 2004
Messages
227
no code running, no macros and no events.

But, Tom, your transposing the array works great and FAST!

Thanks, -Mike
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,805
Messages
5,833,764
Members
430,230
Latest member
Yimmie

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
Top