Please Note: This article is written for users of the following Microsoft Excel versions: 2007 and 2010. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Specifying the Size of Chart Objects.
by Allen Wyatt
(last updated October 14, 2016)
When you create a Excel chart, as an object to be placed in a worksheet, the chart object is automatically sized to some pre-determined size that Excel selects. You may not want the chart object to be whatever size Excel determines; you may want your chart objects to always be a standard size, so they always appear the same relative to your worksheets.
There is no way to specify a chart object size as you are creating the chart. You can, however, resize the chart object after it is created, just as you can resize other graphic elements of your worksheet. You could write a macro to create the object at a particular size, but doing so would remove much of the flexibility that is inherent in Excel's chart-creation tools. For instance, when you specify the size of the chart object being created, you also have to specify other characteristics, such as chart type. It is easier to pick and choose such characteristics through the tools on the ribbon than it is to do so in a macro.
You can, however, easily create a macro that will resize an existing chart object. The key commands of such a macro would be changing the Width and Height properties for the chart object. In VBA, these properties are specified in points. Thus, if you wanted to resize the chart object so it was 4 inches high, you would set the Height property to 288, which is the number of points in 4 inches (4 * 72).
The following macro gives an example of one way to step through all the chart objects on a worksheet and make them the same size. This particular macro sets the width of each chart object to 4 inches, and the height to 3 inches.
Sub ResizeCharts() For j = 1 To ActiveSheet.Shapes.Count If ActiveSheet.Shapes(j).Type = msoChart Then ActiveSheet.Shapes(j).Width = 4 * 72 ActiveSheet.Shapes(j).Height = 3 * 72 End If Next j End Sub
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8526) applies to Microsoft Excel 2007 and 2010. You can find a version of this tip for the older menu interface of Excel here: Specifying the Size of Chart Objects.
Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!
Want a handy way to make the data ranges for your chart more dynamic? Here are some great ideas you can put to work right ...Discover More
It can be frustrating when Excel doesn't display the formatting options that you know it should for your charts. This tip ...Discover More
Excel allows you to add all sorts of objects to your worksheets. Among the objects you can add are text boxes, shapes, and ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.