ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Graphs (https://www.excelbanter.com/excel-programming/334451-graphs.html)

Douglas Voltin

Graphs
 
I am currently working on a bar graph and in this graph I want it to find if
a value is over 50 then show one of the bars red. Is there a macro out
there that will enable the graph to such function? If so what is it?

Thank you

Doug



Rowan[_2_]

Graphs
 
This is an illustration of how this could be done. It will need to be adapted
to suit your graph. In this case there is only one graph on the sheet ("Chart
1"). The macro checks the data used to create series one on the graph - this
is held in the range ("B2:F2").

Sub ChngColour()

Dim dRng As Range
Dim Cell As Range

With Sheets("Sheet1")
Set dRng = .Range("B2:F2")
For Each Cell In dRng
If Cell.Value = 50 Then
.ChartObjects("Chart 1").Activate
With ActiveChart
.SeriesCollection(1). _
Points(Cell.Column - 1). _
Interior.ColorIndex = 3
End With
End If
Next Cell
End With
Range("A1").Select

End Sub

Hope this helps
Rowan

"Douglas Voltin" wrote:

I am currently working on a bar graph and in this graph I want it to find if
a value is over 50 then show one of the bars red. Is there a macro out
there that will enable the graph to such function? If so what is it?

Thank you

Doug




Jon Peltier[_9_]

Graphs
 
Doug -

Here's a non-VBA approach:

http://peltiertech.com/Excel/Charts/...nalChart1.html

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______


Douglas Voltin wrote:

I am currently working on a bar graph and in this graph I want it to find if
a value is over 50 then show one of the bars red. Is there a macro out
there that will enable the graph to such function? If so what is it?

Thank you

Doug




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

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