rohrl77
rohrl77

Reputation: 3337

How to resize chart sheets in Excel

To be clear, I'm not asking how to resize charts ON a worksheet, but how to resize Charts that ARE worksheets.

I want to resize the chart to be 3.79cm high and 5.91 wide.

Though I have done this in the past already, I'm currently at a loss of how I did it. I've been trying and playing around with the code below:

Sub qqq()
Dim x

With Chart6
    .ChartArea.Height = 379.03
    .ChartArea.Width = 591.03
End With

End Sub

When I try to run it I get "Run Time Error 5"

What am I missing/not seeing?

Upvotes: 3

Views: 12765

Answers (1)

R3uK
R3uK

Reputation: 14537

The issue is that the input for Height and Width are in points and not in mm!

Using this converter (1 Centimeter = 28.346... Points) or the built-in function CentimetersToPoints :

Sub qqq()
Dim x

With Chart6
    .ChartArea.Height = 107.3
    .ChartArea.Width = 167.5
    .ChartArea.Height = CentimetersToPoints(3.79)
    .ChartArea.Width = CentimetersToPoints(5.91)
End With

End Sub

Upvotes: 2

Related Questions