Welcome to MSDN Blogs Sign in | Join | Help

VBA + Excel Performance: Your Feedback Requested...

The Excel blog is back after a short break for the holidays.  Happy New Year!  Today's post comes from Chad Rothschiller, a Program Manager on the Excel team, who is looking at ways to improve performance in the next version of Excel.

The Excel development team is currently investigating a number of scenarios where VBA macros take longer to run in Excel 2007 than in earlier versions (i.e. Excel 2003). 
 
We are looking for folks who believe they have run into a VBA performance slowdown and who would be willing to share their code/workbook/steps to reproduce the issue.  Given the enormous variety of solutions people build in Excel using VBA, we think it is important to survey the Excel community to collect a range of examples that are important to Excel users.
 
Specifically, we are interested in looking for VBA code that takes longer to run in Excel 2007 than in previous versions of Excel.  Other than that, pretty much anything goes with respect to feature & code usage.  To successfully analyze any problem, we really need to be able to run the code & reproduce the problem in-house, so the more specific and helpful the comment, the better.  General comments about something slowing down, without the example code that demonstrates the issue, can prove difficult to isolate and analyze.
 
A couple notes:

  • Don't forget to send us the workbook as well, if it contains data or a certain structure required by your code (for example, if your code assumes particular sheet names).
  • If you can't send us the whole solution, or if you need to simplify the code at all, please keep in mind that those changes can end up altering where the performance bottle neck occurs, create new bottle necks, etc. In these cases it would be really helpful to also send us:
    • a description of what the original code is doing,
    • what sort of slowdown you are seeing on your target systems

... this simply helps us reproduce your results in-house.
 
We have already taken a look on the web for reported issues and followed up with some folks, but if you've already posted comments publicly, it wouldn't hurt for you to let us know those links just to be sure we've covered those.  Anything submitted will be treated as 100% confidential and used only for our own internal performance testing.
 
Folks can send files or descriptions to: xlfiles@microsoft.com.  If emailing files will not work, contact us and we can make other arrangements.  Once we have the code / solutions, we will baseline their performance in earlier versions of Excel and then run it on a set of test machines using the version of Excel that's currently under development, and compare the results.  Thanks in advance to anyone that sends in examples.

Published Tuesday, January 06, 2009 11:11 PM by Joseph Chirilov

Comments

# Is VBA in Excel 2007 Slower Than in Excel 2003? | Excel Hints

# re: VBA + Excel Performance: Your Feedback Requested...

Thursday, January 08, 2009 5:35 AM by Doug Jenkins

I have covered these issues quite a bit on my blog; it's excellent news that you are looking at improving things.

The main problem (as far as I am concerned) seems to be with transferring data between Excel and VBA, which takes about 3 times longer in 2007 than 2000.

Relevent Blog posts include:

http://newtonexcelbach.wordpress.com/2008/02/23/worksheetfunction-vs-udf/

http://newtonexcelbach.wordpress.com/2008/05/06/excel-2007-performance-feedback-please/

http://newtonexcelbach.wordpress.com/2008/05/24/worksheetfunction-vs-udf-2/

I will send a workbook with the UDFs referred to in the posts, and will also post a link here on my blog (just for the millions of people who read Newton-Excel-Bach, but not here ;))

Another performance issue I have encountered recently, probably not directly related to VBA, is the time taken for re-drawing complex drawings.  I an currently working on a drawing with about 3000 lines that takes about 1 minute to redraw from VBA.  If something can be done to substantially improve this performance it would be greatly appreciated.

Doug Jenkins.

# re: VBA + Excel Performance: Your Feedback Requested...

Sunday, January 11, 2009 7:24 PM by Ken More

I have developed a simulation model (commercially available as the M/M/+M Model) using MS Excel 2003 with Visual Basic Macro code.  This model runs well in Excel 2003, however, it is unacceptably slow in your Excel 2007 release.

I believe you will find that getting this model to perform well in Excel 2007 will be the ultimate test of Excel 2007's performance capabilities.  I will send additional information to xlfiles@microsoft.com

# re: VBA + Excel Performance: Your Feedback Requested...

Monday, January 12, 2009 2:14 AM by sam

While handling shapes, Excel 2007 is pretty(more shades of blue) slow

Download this file - Airlines- Sparklines

http://sourceforge.net/project/showfiles.php?group_id=229215&package_id=300038&release_id=642194

In 2003 its prety fast

In 2007 it takes it own sweet time

I have also mailed the file to the e-mail address

# re: VBA + Excel Performance: Your Feedback Requested...

Tuesday, January 13, 2009 8:06 PM by Anthony Berglas

The Spreadsheet Detective is a program that interacts tightly with basic Excel features.  It runs about 50% to 200% slower in 2007, after I have spent time optimizing.  Fortunately compters have become faster...

If you are really interested I could give you a version and also will do the work to make some specific, extracted test cases.

One big performance issue introduced back in Excl 1997 is that every reference to drawing objects seems to involve a linear search, which kills performance if there are a significant number of drawing objects.  My guess is that fixing that would be an easy win for youy.  

Much better to be able to say 2007 is slower at some things and faster at others than just to say it is slower on everything.

Anthony

# re: VBA + Excel Performance: Your Feedback Requested...

Wednesday, January 14, 2009 5:28 PM by Doug Jenkins

"One big performance issue introduced back in Excl 1997 is that every reference to drawing objects seems to involve a linear search, which kills performance if there are a significant number of drawing objects.  My guess is that fixing that would be an easy win for you"

Anthony - I hope you are right about the last bit, and that someone at Microsoft accepts the challenge.

Acceptable redraw speeds would make Excel a reasonable option for complex drawing applications for which at present it is just too slow.  Example here:

http://newtonexcelbach.wordpress.com/2009/01/13/drawing-in-excel-9-perspective-projection/

# re: VBA + Excel Performance: Your Feedback Requested...

Friday, January 23, 2009 4:44 AM by Harald Staff

Deleting rows by code is too slow in Excel 2007:

For L = 200000 to 2 Step -1

 If Test(L) = True then Rows(L).Delete

Next

Best wishes Harald

# re: VBA + Excel Performance: Your Feedback Requested...

Thursday, January 29, 2009 9:35 AM by D. White

I have a speed problem with Excel 2007 when using the SOLVER Add-In.  The same applicaiton runs just fine in Excel 2003 but takes minutes to execute in Excel 2007.  Has anyone else experienced this? Any solutions? Help!

# re: VBA + Excel Performance: Your Feedback Requested...

Saturday, January 31, 2009 6:07 PM by Charlie Hall

Clearing cells is also very slow - in one of my models, the macro clears a range of 4 columns wide and 20,000 rows deep - the code is one vba line

sheet.cells(x,y).resize(rowsize, columnsize).clearcontents

on Excel 2003 it runs near instantaneously - on Excel 2007 it takes 10-15 seconds before it returns to the next vba line  (15 seconds is just my impression - not measured directly - and there were different computers involved) - but the delay was quite astounding

-Charlie

# re: VBA + Excel Performance: Your Feedback Requested...

Saturday, January 31, 2009 7:38 PM by Doug Jenkins

Charlie - do you have Google Desktop installed on the XL 2007 computer?  If so have a look at this link, it may solve your problem:

http://www.dailydoseofexcel.com/archives/2007/12/18/google-toolbar-slows-excel/

# re: VBA + Excel Performance: Your Feedback Requested...

Thursday, February 05, 2009 4:28 PM by Chad

Charlie - I'm not seeing the slowdown. Would you mind sending in an example to xlfiles@microsoft.com?

# Excel VBA Performance Coding Best Practices

Thursday, March 12, 2009 7:37 PM by Microsoft Excel

Today’s author, Chad Rothschiller, a Program Manager on the Excel team, is back with a follow up from

New Comments to this post are disabled
 
Page view tracker