ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   condition chart color bar range (https://www.excelbanter.com/charts-charting-excel/146278-condition-chart-color-bar-range.html)

Daniel

condition chart color bar range
 
Hi all
I used macro of the colorbars() for my condition chart as below
My question is I have another condition on column F, how can I add
to this sub colorbars()? Thanks in advance.
Daniel
----------------------------------------

Sub ColorBars()

Application.ScreenUpdating = False

Dim Rng As Range
Dim Cnt As Integer

Cnt = 1

For Each Rng In Range("E2:E41")
Set Pts = ActiveChart.SeriesCollection(1).Points(Cnt)
If Rng.Value = "" Then
Pts.Interior.ColorIndex = 44
ElseIf Rng.Value = 2684 Then
Pts.Interior.ColorIndex = 43
ElseIf Rng.Value = 1 Then
Pts.Interior.ColorIndex = 5

End If
Cnt = Cnt + 1
Next Rng
End Sub


Jon Peltier

condition chart color bar range
 
For clarity change this
For Each Rng In Range("E2:E41")

to
For Each Rng In Range("E2:E41").Cells


To see what's in the adjacent cell, use Rng.Offset(, 1).Value, then expand
on your If structures to account for this value as well.

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


"Daniel" wrote in message
...
Hi all
I used macro of the colorbars() for my condition chart as below
My question is I have another condition on column F, how can I add
to this sub colorbars()? Thanks in advance.
Daniel
----------------------------------------

Sub ColorBars()

Application.ScreenUpdating = False

Dim Rng As Range
Dim Cnt As Integer

Cnt = 1

For Each Rng In Range("E2:E41")
Set Pts = ActiveChart.SeriesCollection(1).Points(Cnt)
If Rng.Value = "" Then
Pts.Interior.ColorIndex = 44
ElseIf Rng.Value = 2684 Then
Pts.Interior.ColorIndex = 43
ElseIf Rng.Value = 1 Then
Pts.Interior.ColorIndex = 5

End If
Cnt = Cnt + 1
Next Rng
End Sub





All times are GMT +1. The time now is 05:56 AM.

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