Link to home
Start Free TrialLog in
Avatar of Randy Downs
Randy DownsFlag for United States of America

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of [ fanpages ]
[ fanpages ]

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Randy Downs

ASKER

ClearContents seems to work better. Has Clear become devalued?
That seems to have fixed it. What;s the difference in .Clear & .ClearContents ?
Avatar of [ fanpages ]
[ fanpages ]

Clear removes in-cell formulae/values and formatting.
ClearContents just removes the formulae/values.
OK, I think we can live without the formatting being cleared. Thanks for the speedy advice
works great for my application. No idea why  Clear takes so long when ClearContents zip right on.