Saturday, January 19, 2013

Add and Remove fill colors from chart Using VBA

If you want to add or remove fill colors from chart.Try this macro - 








Macro to add fill color 

Sub add_fill_colors()
    Dim cht As Chart
    ' change chart name here
    Set cht = Sheets("Sheet1").ChartObjects("Chart 3").Chart
    'add fill color to chart area
    cht.ChartArea.Interior.Color = RGB(205, 104, 137)
    ' add fill color to Plot Area
    cht.PlotArea.Interior.Color = RGB(205, 193, 197)
End Sub


Macro to remove fill color

Sub remove_fill_colors()
    Dim cht As Chart
    ' change chart name here
    Set cht = Sheets("Sheet1").ChartObjects("Chart 3").Chart
    'Remove fill color from chart area
    cht.ChartArea.Fill.Visible = False
    'remove fill color from Plot Area
    cht.PlotArea.Fill.Visible = False
End Sub

1 comment:

  1. I am glad that I saw this post. It is informative blog for us and we need this type of blog thanks for share this blog, Keep posting such instructional blogs and I am looking forward for your future posts.
    Paint for Mac

    ReplyDelete

Import data from SQL

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