• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA Background colour change

ianb

Member
Hi,


Does nay one have a program that will change background colours.


e.g.


1. If background colour is light grey then change to dark grey

2. if background colour is brown then change to indigo.


I need various background colours to change on a various work sheets.


Would look simlar to this previous program that is for charts.


Dim ws As Worksheet

Dim ch As ChartObject


For Each ws In Worksheets

For Each ch In ws.ChartObjects


ch.Activate

ActiveChart.ClearToMatchStyle

ActiveChart.ChartStyle = 18

ActiveChart.ClearToMatchStyle

Next ch

Next ws


End Sub


Many Thanks.
 
IanB


Try this:

[pre]
Code:
Sub Reset_Chart_Colors()

Dim ws As Worksheet
Dim ch As ChartObject

For Each ws In Worksheets
For Each ch In ws.ChartObjects

MsgBox ch.Chart.ChartArea.Format.Fill.ForeColor.RGB

If ch.Chart.ChartArea.Format.Fill.ForeColor.RGB = 1000 Then _
ch.Chart.ChartArea.Format.Fill.ForeColor.RGB = 100000 'Chart Area
If ch.Chart.PlotArea.Format.Fill.ForeColor.RGB = 1000 Then _
ch.Chart.PlotArea.Format.Fill.ForeColor.RGB = 200000 'Plot Area
Next ch
Next ws

End Sub
[/pre]

Change the RGB Values to suit
 
Back
Top