Excel VBA MarkerStyle

时间:2014-09-29 12:26:42

标签: excel vba excel-vba

我正在尝试将系列标记样式更改为十字X.

我在新的excel文件中创建了测试脚本:

ActiveChart.SeriesCollection(1).Select
Selection.MarkerStyle = xlMarkerStyleX

它工作正常。我有:

    Worksheets("RecordID Chart").ChartObjects(1).Activate
    ActiveChart.SeriesCollection.NewSeries
    ActiveChart.SeriesCollection(graph + 2).Name = lo.ListColumns("RecordID").DataBodyRange.Rows(1)
    ActiveChart.SeriesCollection(graph + 2).XValues = tesPercentage
    ActiveChart.SeriesCollection(graph + 2).Values = testError
    ActiveChart.SeriesCollection(graph + 2).MarkerStyle = xlMarkerStyleX
    ActiveChart.SeriesCollection(graph + 2).MarkerSize = 5
    ActiveChart.SeriesCollection(graph + 2).Format.Line.ForeColor.RGB = myCol & graph
    ActiveChart.SeriesCollection(graph + 2).Select
    Selection.Format.Line.Visible = msoFalse

有没有人有想法?

实际上,它是交叉的,但它不会显示为十字架:

enter image description here

所以我相信Marker Fill或Marker Line Color有一些问题...我仍然很困惑。

2 个答案:

答案 0 :(得分:2)

假设这将达到目的:

ActiveChart.SeriesCollection(1).Select
With Selection
    .MarkerStyle = xlMarkerStyleX
    .MarkerSize = 7
    .MarkerBackgroundColorIndex = xlColorIndexNone
    .MarkerForegroundColorIndex = xlColorIndexAutomatic
End With

答案 1 :(得分:1)

看起来您的标记填充颜色与标记前景色相同。你需要改变它。