Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jan 2007
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macro to make charts same size (2003)

    I am working on a large project where I need to create multiple charts from data in a workbook. I am trying to find a quick way of making sure that all the charts are the same size. I have recorded a macro to try to do this, but unfortunately it only works on one chart. I can see that on the attached example, the code says "Chart1" - but can anybody please let me know how I can change this to make the macro work on whichever chart I select? I just need the code to work on one chart at a time, not all the charts in the workbook. Hope this makes sense!!

    Thanks very much in advance to anyone who can help.
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro to make charts same size (2003)

    There is no code in the workbook that you attached. If you want to select a chart before running your macro, you can refer to the selected chart as ActiveChart in your macro.
    The Shape object that contains the chart is ActiveChart.Parent.ShapeRange. So for example you can set the width of the active chart to 5 inches:

    ActiveChart.Parent.ShapeRange.Width = Application.InchesToPoints(5)

  3. #3
    Star Lounger
    Join Date
    Jan 2007
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro to make charts same size (2003)

    Ooops! Obviously forgot to resave the file! Thank you so much for your help Hans - it works perfectly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •