Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Error message when you run a VBA macro to adjust the charts on an Excel 2007 worksheet: "Run-time error '16': Expression too complex"


View products that this article applies to.

Symptoms

When you run a Microsoft Visual Basic for Applications (VBA) macro to adjust the charts on a Microsoft Office Excel 2007 worksheet, you receive the following error message:
Run-time error '16':

Expression too complex

↑ Back to the top


Workaround

To work around this issue, add the following code to your VBA macro. Add this example code before the code that retrieves the inside plot area of the chart.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
Application.ScreenUpdating = true           
Chart.Refresh
DoEvents

↑ Back to the top


More information

For more information about the plot area, follow these steps:
  1. On the Visual Basic Editor Help menu, click Microsoft Visual Basic Help.
  2. In the Search box, type plotarea, and then click Search.

↑ Back to the top


Keywords: KB928988, kbexpertiseinter, kbvba, kbprb, kbautomation, kbprogramming, kbchart, kbmacro, kbtshoot, kberrmsg

↑ Back to the top

Article Info
Article ID : 928988
Revision : 6
Created on : 10/15/2007
Published on : 10/15/2007
Exists online : False
Views : 231