VBA for Charts

VBA for Charts

Change Chart Max Axis

Sub ChartMaxAxis()
Dim ct As Chart
Dim AxisMaxValue As Integer
Dim sh1 As String
Dim sh2 As String
Dim sh3 As String
sh1 = "Slide 7 (1)" '< change sheet name here
sh2 = "Slide 7 (2)" '< change sheet name here
sh3 = "Slide 7 (3)" '< change sheet name here
AxisMaxValue = 2000 '< change to any cell
'sheet Slide 7 (1)
Set ct = Sheets(sh1).ChartObjects("Chart 2").Chart
    With ct
        .Axes(xlValue).MaximumScale = AxisMaxValue
    End With
Set ct = Nothing
'sheet Slide 7 (2)
Set ct = Sheets(sh2).ChartObjects("Chart 2").Chart
    With ct
        .Axes(xlValue).MaximumScale = AxisMaxValue
    End With
Set ct = Nothing
'sheet Slide 7 (3)
Set ct = Sheets(sh3).ChartObjects("Chart 2").Chart
    With ct
        .Axes(xlValue).MaximumScale = AxisMaxValue
    End With
Set ct = Nothing
End Sub


एक टिप्पणी भेजें

0 टिप्पणियाँ