Pages

Saturday, January 19, 2013

Add Chart Borders Using VBA

If you want to add or format chart borders . Try this macro

















Sub Add_chart_borders_vba()
    Dim cht As Chart
    ' change chart name here
    Set cht = Sheets("Sheet1").ChartObjects("Chart 3").Chart
        
    ' add plot area border
    With cht.PlotArea.Border
          .LineStyle = xlContinuous
          .Weight = xlThin
          .Color = RGB(10, 255, 186)
    End With
    
    ' add chart area border
    With cht.ChartArea.Border
          .LineStyle = xlDot
          .Weight = xlThin
          .Color = RGB(71, 60, 139)
    End With
End Sub

No comments:

Post a Comment