Pages

Saturday, January 19, 2013

Set chart axis options using VBA

If you want to set chart axis options using VBA. Try this macro



















Sub set_axis_options()

Dim cht As Chart
'change chart name here
Set cht = Sheets("Sheet1").ChartObjects("Chart 3").Chart
    
    With cht.Axes(xlValue, xlPrimary)
        .MaximumScale = 16
        .MinimumScale = 0
        .MajorUnit = 2
        .TickLabels.NumberFormat = "0.0"
        .TickLabels.Orientation = 0
        .TickLabelPosition = xlLow
        .TickLabels.Font.Color = vbBlack
        .Border.Color = vbBlack
        .Border.Weight = xlThin
        .ReversePlotOrder = False
    End With
  
    
End Sub

No comments:

Post a Comment