Excel 2013 VBA very slow on some PCs

We have an Excel VBA macro that takes 9 minutes to complete on one PC while most run the macro in about 30 seconds. I can get to this section of the macro in the problem PC in about 19 seconds but executing the .Clear takes over 2 minutes.

Note that this macro is a carryover from 2001 and we've had to modify it to run on the newer versions of Excel. All Computers are using Excel 2013 but the version varies slightly (15.0.4753.1000 vs. 15.0.4745.1000)

' Clear error flags
    [A1].Select
    Range(Cells(2, 1), Cells(sze, 1)).Clear

Open in new window


Local variables:
sze = 238
LVL 30
Randy DownsOWNERAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

[ fanpages ]IT Services ConsultantCommented:
What are you attempting to clear?

Is there any difference if you use the ClearContents method instead?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Randy DownsOWNERAuthor Commented:
ClearContents seems to work better. Has Clear become devalued?
0
Randy DownsOWNERAuthor Commented:
That seems to have fixed it. What;s the difference in .Clear & .ClearContents ?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

[ fanpages ]IT Services ConsultantCommented:
Clear removes in-cell formulae/values and formatting.
ClearContents just removes the formulae/values.
0
Randy DownsOWNERAuthor Commented:
OK, I think we can live without the formatting being cleared. Thanks for the speedy advice
0
Randy DownsOWNERAuthor Commented:
works great for my application. No idea why  Clear takes so long when ClearContents zip right on.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.