Chart Plot Area Size

Chris84

Board Regular
Joined
Aug 17, 2012
Messages
78
Hi

I have some code which creates 3 bar charts
1st Chart % between 40 and 120
2nd Chart count between 8 and 100
3rd Chart count between 200 and 5000
the code makes the charts identical in size in some instances this works great and makes the data easy to read.

Normally what happens is Chart 2's Vertical (Value) Axis is narrower than the other charts which makes the plot area wider.

Is there a way to set the plot area size of the bar chart without this affecting the axis size, alternatively can I change the Vertical (Value) Axis width.

The code i'm using for the width is

Code:
    ActiveChart.PlotArea.Select
    Selection.Left = 20
    Selection.Width = 490

but this includes the axis

Any help is greatly appreciated
 
Hi AlphaFrog

I am getting a compile error on the above code Variable not defined and w# = is highlighted

Thanks
 
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Try this...
Code:
    [COLOR=#ff0000]Dim w As Double[/COLOR]
    [COLOR=darkblue]With[/COLOR] ActiveChart
        .Axes(xlValue).TickLabels.NumberFormat = "0000"
        w = .PlotArea.InsideWidth
        .Axes(xlValue).TickLabels.NumberFormat = "0"
        [COLOR=darkblue]With[/COLOR] .PlotArea
            w = .InsideWidth - w
            .Width = .Width - w
            .Left = Abs(.Left - w)
        [COLOR=darkblue]End[/COLOR] [COLOR=darkblue]With[/COLOR]
    [COLOR=darkblue]End[/COLOR] [COLOR=darkblue]With[/COLOR]

Read this about declaring variable and the use of Option Explicit
Declaring Variables
 
Upvote 0
Hi AlphaFrog

Found another way using the InsideWidth from your code

Code:
    With ActiveChart
        .PlotArea.InsideWidth = 450
        .PlotArea.InsideLeft = 60
        .Axes(xlValue).AxisTitle.Left = 1
    End With

Thanks
 
Upvote 0

Forum statistics

Threads
1,214,808
Messages
6,121,686
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top