Or even this or incorporate a select case

Sub Chart_formating_KaranSAS()
Dim x As Long
With Sheets("SAS").ChartObjects("Chart 1") _
    .Chart.SeriesCollection(1)
For x = 1 To .Points.Count
   .Points(x).Interior.Color = vbBlue
If .Points(x).DataLabel.Text > 40 Then _
   .Points(x).Interior.Color = vbGreen
If .Points(x).DataLabel.Text > 70 Then _
   .Points(x).Interior.Color = vbRed
Next
End With
End Sub

Don Guillett
SalesAid Software
dguille...@gmail.com

From: NOORAIN ANSARI 
Sent: Wednesday, January 11, 2012 6:08 AM
To: excel-macros@googlegroups.com 
Subject: Re: $$Excel-Macros$$ Conditional Chart

Dear Karan,

Please try below code and see attached Sheet..

Sub Chart_formating_Karan()
Dim srs As Series
For Each srs In Sheets(1).ChartObjects("Chart 1").Chart.SeriesCollection
For i = LBound(srs.Values) To UBound(srs.Values)
If srs.Values(i) <= 40 Then
srs.Points(i).Interior.Color = vbBlue
ElseIf srs.Values(i) > 41 And srs.Values(i) < 70 Then
srs.Points(i).Interior.Color = vbGreen
Else
srs.Points(i).Interior.Color = vbRed
End If
Next i
Next srs
End Sub

-- 

Thanks & regards,
Noorain Ansari
http://excelmacroworld.blogspot.com/
http://noorain-ansari.blogspot.com/

On Wed, Jan 11, 2012 at 5:22 PM, Karan Singh <karan1...@gmail.com> wrote:



  Dear All,


  Is there any way to make a conditional chart. I need to make a conditional 
chart. Kindly help me in this.

  conditions 

  1. If value is Less than 40 = bar graph colour : Blue
  2. If value is 41-70 = bar graph colour is Green
  3. if value is 71-100 = Red


  I'v attached the file for the sample. Kindly help. It would be very helpful 
if it solve through formulae rather than macro.


  Regards

  Kaяan 

         



  -- 
  FORUM RULES (986+ members already BANNED for violation)
   
  1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
   
  2) Don't post a question in the thread of another member.
   
  3) Don't post questions regarding breaking or bypassing any security measure.
   
  4) Acknowledge the responses you receive, good or bad.
   
  5) Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 
   
  NOTE : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.
   
  
------------------------------------------------------------------------------------------------------
  To post to this group, send email to excel-macros@googlegroups.com





-- 
FORUM RULES (986+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.
 
------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

-- 
FORUM RULES (986+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

Reply via email to