View Single Post
  #3   Report Post  
silver23
 
Posts: n/a
Default

I have a similar dilemma, but have yet to figure-out the solution.

Sheet 1, cell A1 contains +1, 0 or -1 (derived from contents of another
workbook).
Sheet 2 contains an imbedded line chart.

How does one dynamically code for the 'chart area', (leaving the 'plot area'
as-is), of the chart in sheet 2 to be:
a) green if Sheet1,A1 is +1
b) grey if Sheet 1, A1 is 0
c) red if Sheet 1, A1 is -1

???

"John Mansfield" wrote:

If you are working with an embedded chart, select the outside of the chart
and run this macro:

Sub ChangeColors1()
ActiveChart.ChartArea.Interior.ColorIndex = 8
ActiveChart.PlotArea.Interior.ColorIndex = 7
End Sub

To change the ChartArea and PlotArea colors for all embedded charts on the
worksheet, you can use something like this:

Sub ChangeColors2()
Dim ChtObj As ChartObject
For Each ChtObj In ActiveSheet.ChartObjects
ChtObj.Interior.ColorIndex = 4
ChtObj.Chart.PlotArea.Interior.ColorIndex = 3
Next ChtObj
End Sub

If you're using a chart sheet, try:

Sub ChangeColors3()
Dim Cht As Chart
Set Cht = Sheets("Chart2")
Cht.ChartArea.Interior.ColorIndex = 8
Cht.PlotArea.Interior.ColorIndex = 7
End Sub

--
Regards,
John Mansfield
http://www.pdbook.com


"Cenk Ursavas via OfficeKB.com" wrote:

HOw can I change the background and foreground color of an excel graph?
I tried :
------------------------------------
With myChart.ChartArea.Fill
.Visible = True
.ForeColor.SchemeColor = 15
.BackColor.SchemeColor = 17
End With
------------------------------------
the background color changes but the foreground does not change...Does
foreground here mean the grey area because thats the color I want to change.
Thanks

--
Message posted via http://www.officekb.com