bottom
Great ExcelTips!
         
Your e-mail address is safe!
Close Note

Tips.Net > ExcelTips Home > Charts > Creating Charts > Specifying the Size of Chart Objects

Specifying the Size of Chart Objects

Summary: Create a new chart object in an existing worksheet, and Excel automatically makes the object 25% of whatever the screen size is. If you want a different size (without manually resizing), you are out of luck unless you use a macro to create the chart object. This tip explains how you can do this. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, and Excel 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. If you are looking for a free third-party solution to resizing charts--along with performing other common tasks on charts--then consider Chart Tools, written by John Walkenbach. You can find it here:

http://j-walk.com/ss/excel/files/charttools.htm

Tip #2208 applies to Microsoft Excel versions: 97 | 2000 | 2002 | 2003


Organize Your Data! Using the powerful sorting capabilities of Excel can help you get your data into just the order you need. Find out how you can use the full capabilities of sorting to your benefit.
 
Check out ExcelTips: Serioius Sorting today!

Helpful Links

Ask an Excel Question
Make a Comment

Tips.Net Home

ExcelTips FAQ
ExcelTips Premium

Learn Access Now

Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Word2007 Tips
WordTips

Advertise on the
ExcelTips Site

 

Great Info!

Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your e-mail address and click "Subscribe."
     
(Your e-mail address will never be shared with anyone, ever.)