Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Specifying the Size of Chart Objects.
Written by Allen Wyatt (last updated September 4, 2021)
This tip applies to Excel 97, 2000, 2002, and 2003
When you create a Excel chart, as an object to be placed in a worksheet, the chart object is automatically sized to fit one-quarter of the screen size. You may not want the chart object to be this particular size. For instance, 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 the Chart wizard. 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 Chart wizard 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.
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
This particular macro sets the width of each chart object to 4 inches, and the height to 3 inches.
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2208) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Specifying the Size of Chart Objects.
Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!
If you have a lot of records in a data table, you may want to create individual charts based on the information in those ...
Discover MoreWant 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 MoreNeed to generate a chart in the fastest possible way? Just use this shortcut key and you'll have one faster than you can ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments