2012-07-05 2 views
3

Arrow to Indicate Special Points on Excel chart like this을 사용하는 몇 가지 예를 보았습니다. 하지만 VBA를 사용하여이를 달성하고 싶습니다. 예를 들어 차트의 어떤 점이 90보다 크면 해당 점에 해당하는 화살표가 표시됩니다.화살표 VBA를 사용하여 특수 점 지정하기

VBA에서 어떻게해야하는지 제안 해주세요. 어떤 도움을 주시면 감사하겠습니다.

외에도 바로 포인트 색상을 변경에서 업데이트 그 시점이 더 유명하게 다른 좋은 제안이 있습니다.

업데이트 2

지금이 코드를 사용하고 있습니다.

For Each oCell In Range("e4:e" & LastRow) 'loop 

     If oCell.Value < sd13 Then 'rule 13s 
      Range("V4").Value = "Rule 13s voilated!" 
      Range("V4:w4").Interior.Color = RGB(255, 0, 0) 
     ActiveWorkbook.Sheets("LDL-C").ChartObjects("Chart 1047").Chart.SeriesCollection(1).Points(j).MarkerBackgroundColor = RGB(255, 0, 0) 
      End If 
      Next 

답변

1

여기에 화살표와 함께 할 만하는 방법 확실하지 그냥 관심 지점의 색상 변경하는 방법입니다 :

 With ActiveSheet.ChartObjects(ChartName).Chart.SeriesCollection("NCDs") 
      For currentPoint = 1 To .Points.Count 
       If Range("G" & currentPoint + 34).Value = True Then 
        With .Points(currentPoint).Format 
         .Fill.BackColor.RGB = RGB(50, 150, 50) 
         .Fill.ForeColor.RGB = RGB(50, 150, 50) 
         .Line.ForeColor.RGB = RGB(50, 150, 50) 
        End With 
       Else 
        With .Points(currentPoint).Format 
         .Fill.BackColor.RGB = RGB(150, 50, 50) 
         .Fill.ForeColor.RGB = RGB(150, 50, 50) 
         .Line.ForeColor.RGB = RGB(150, 50, 50) 
        End With 
       End If 
      Next currentPoint 
     End With 

그냥 이름을 변경하고 조건 절을 ... 또한 .Points (currentPoint) 객체에는 화살표를 배치하는 데 사용할 수있는 x, y 위치 속성이있을 수도 있습니다. 그것에 대해 확실하지 않지만 좋은 시작 지점처럼 보인다.

+0

감사하지만 또 다른 스냅 샷 http://stackoverflow.com/questions/11136194/change- the-point-color-in-chart-excel-vba ... 그러나 지금 나는 그것을 가리키는 한 점에 화살표를 보여주고 싶다. 의미있는. – james

+0

위에서 사용 된 포인트 오브젝트에 이미지 내의 x, y 위치 코디가없는 한, 화살표 위치를 어떻게 계산할 수 있는지는 알 수 없습니다. 당신은 또한 제작자에게 단지 크기와 다른 모양을 3 번 만들 수 있습니다. – Dan

+0

https://groups.google.com/forum/?fromgroups#!topic/microsoft.public.excel.charting/AgWMOIKU4Do 링크에서 Joe Peltier의 답변을 확인하십시오. – Dan

2

포인트 컬러를 변경하는 것 외에 다른 포인트가 더 눈에 잘 띄는 다른 좋은 제안이 있습니다.

도움이 되셨습니까?

With ActiveChart 
    For i = 1 To .SeriesCollection.Count 
     a = .SeriesCollection(i).Values 
     For l = 1 To .SeriesCollection(i).Points.Count 
      If mymax < a(l) Then 
       mymax = a(l) 
       .SeriesCollection(i).DataLabels.Select 
       Selection.Format.Line.Visible = msoTrue 
       Selection.Format.Line.Visible = msoFalse 

       .SeriesCollection(i).Points(l).DataLabel.Select 
       .SeriesCollection(i).Points(l).Select 
       .SeriesCollection(i).DataLabels.Select 
       .SeriesCollection(i).Points(l).DataLabel.Select 

       With Selection.Format.Line 
        .Visible = msoTrue 
        .ForeColor.ObjectThemeColor = msoThemeColorAccent1 
        .ForeColor.TintAndShade = 0 
        .ForeColor.Brightness = 0 
       End With 
       With Selection.Format.Line 
        .Visible = msoTrue 
        .Weight = 2 
       End With 
      End If 
     Next l 
    Next 
End With 

스냅

enter image description here

난 이미 수행 한

enter image description here

+0

감사하지만 차트와 요점이 같은 경우는 어떨까요? http://stackoverflow.com/questions/11136194/change-the-point-color-in-chart-excel-vba – james

+0

감사합니다. Sir. 업데이트를 참조하십시오. – james

+0

이 비트의 기능 : .SeriesCollection (i) .Points (l). DataLabel.Select .SeriesCollection (i) .Points (l) .Select .SeriesCollection (i) .DataLabels.Select .SeriesCollection (i) .Points (l) .DataLabel.Select? 죄송합니다. 댓글에서 엉망진창처럼 보입니다. 변경 한 코드의 4 줄은 선택한 항목을 변경합니다. – Dan

관련 문제