Announcement

Collapse
No announcement yet.

Define the size of plot area

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Define the size of plot area

    Hi,

    I draw 10 charts on one sheet, How can I define the size of the plot area of every chart so that every one has the same size. I double click the plot area, only "patterns" and "area" can select.

    Thanks for the help.

    Linda

  • #2
    Re: Define the size of plot area

    this code will change the width of the plot area on all charts on the sheet. Just change as required.

    Code:
    Sub Macro1()
    Dim sh As Shape
    For Each sh In ActiveSheet.Shapes
    
        ActiveSheet.ChartObjects(sh.Name).Activate
        ActiveChart.PlotArea.Width = 100
    Next sh
    
    End Sub
    Not tested but shoud work
    Rich

    www.imits.co.uk - for all your training and development needs!

    Comment


    • #3
      Re: Define the size of plot area

      Thanks! I will try it.

      Comment


      • #4
        Re: Define the size of plot area

        Hi,

        Although Badger101's code will work it will fail if the sheet has any shapes on it.
        Try this just for chart objects.
        Note that the width will actually only be set to 100 if there is enough room within the chartarea to do it.
        Sub Macro1()

        Dim objCht As ChartObject

        For Each objCht In ActiveSheet.ChartObjects
        objCht.Chart.PlotArea.Width = 100
        Next

        End Sub

        Cheers
        Andy

        Comment

        Working...
        X