ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   Excel 2007 chart gridline color using vba (https://www.excelbanter.com/charts-charting-excel/213822-excel-2007-chart-gridline-color-using-vba.html)

[email protected]

Excel 2007 chart gridline color using vba
 
Hello,
i want to apply a themecolor to a chart gridline using vba. I can
apply normal colors (RGB, index) but not the theme color. Any idea?

thx.
berg

Andy Pope

Excel 2007 chart gridline color using vba
 
Hi,

Here are the various ways fo changing the colour.

With ActiveChart
With .Axes(xlValue, xlPrimary)
If .HasMajorGridlines Then
With .MajorGridlines
.Border.ColorIndex = 5 'set color to blue
.Border.Color = RGB(0, 255, 0) ' green
.Format.Line.ForeColor.ObjectThemeColor =
msoThemeColorAccent2
End With
End If
End With
End With

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
wrote in message
...
Hello,
i want to apply a themecolor to a chart gridline using vba. I can
apply normal colors (RGB, index) but not the theme color. Any idea?

thx.
berg



[email protected]

Excel 2007 chart gridline color using vba
 
On 16 Dez., 14:24, "Andy Pope" wrote:
Hi,

Here are the various ways fo changing the colour.

* * With ActiveChart
* * * * With .Axes(xlValue, xlPrimary)
* * * * * * If .HasMajorGridlines Then
* * * * * * * * With .MajorGridlines
* * * * * * * * * * .Border.ColorIndex = 5 * *'set color to blue
* * * * * * * * * * .Border.Color = RGB(0, 255, 0) ' green
* * * * * * * * * * .Format.Line.ForeColor.ObjectThemeColor =
msoThemeColorAccent2
* * * * * * * * End With
* * * * * * End If
* * * * End With
* * End With

Cheers
Andy

--

Andy Pope, Microsoft MVP - wrote in message

...

Hello,
i want to apply a themecolor to a chart gridline using vba. I can
apply normal colors (RGB, index) but not the theme color. Any idea?


thx.
berg


Thank you!


All times are GMT +1. The time now is 12:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com