vba - 使用 VBA 指示特殊点的箭头

标签 vba excel charts

我见过一些使用Arrow to Indicate Special Points on Excel chart like this的例子。但我想用VBA 来实现这一点。例如,如果图表上的某个点大于 90,那么它会显示与该点对应的箭头。

请建议我应该如何在 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

最佳答案

Apart from just changing the point color is there any other good suggestion to make that point more prominent.

这有帮助吗?

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

关于vba - 使用 VBA 指示特殊点的箭头,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11339362/

相关文章:

excel - 在获取 Excel 工作簿中所有工作表名称的列表期间,VBA 代码的执行速度非常慢

javascript - ChartJS 设置默认轴

vba - 在我的当前选择中获取标题编号

c# - 使用 COM Interop 将对象从 C# 传递到 VBA

vba - 如何将 Excel 与 Google 搜索集成? <VBA </code>

excel - 动态创建命名单元格

javascript - 使用 group() 函数的 Google 可视化堆积柱形图

javascript - 将标记带到 Highcharts 中的网格线前面

excel - 如何使用 VBA Vlookup 填充单元格

带有超链接 ActiveDocument.Range 和 Format 的正则表达式