Showing posts with label Add Chart Borders Using VBA. Show all posts
Showing posts with label Add Chart Borders Using VBA. Show all posts

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

Import data from SQL

Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...