在excel xyscatter图表中更改数据系列的颜色

我试图改变excel图表中的数据点的颜色,但一切即时尝试不成功。

这是我尝试的一种方法,但点仍然显示为蓝色:

With Chrt .ChartType = xlXYScatter Do Until .SeriesCollection.Count = 0 .SeriesCollection(1).Delete Loop .SeriesCollection.NewSeries .SeriesCollection(1).Name = "=""Top Platen""" .SeriesCollection(1).Values = yaxis .SeriesCollection(1).XValues = xaxis ActiveChart.SeriesCollection(1).Select With Selection.Format.Fill .Visible = msoTrue .ForeColor.RGB = RGB(255, 0, 0) .Transparency = 0 .Solid End With 

这是我尝试的另一种方法,仍然数据点显示为蓝色:

 With Chrt .ChartType = xlXYScatter Do Until .SeriesCollection.Count = 0 .SeriesCollection(1).Delete Loop .SeriesCollection.NewSeries .SeriesCollection(1).Name = "=""Top Platen""" .SeriesCollection(1).Values = yaxis .SeriesCollection(1).XValues = xaxis .SeriesCollection(1).Interior.Color = RGB(255,0,0) 

这只是我的代码的一部分,如果需要,我可以提供更多的区域。 任何帮助将不胜感激。

我相信问题是嵌套块变得困惑。 下面是解决这个问题的一种方法,仍然使用嵌套块:

 With Chrt .ChartType = xlXYScatter Do Until .SeriesCollection.Count = 0 .SeriesCollection(1).Delete Loop .SeriesCollection.NewSeries With .SeriesCollection(1) .Name = "=""Top Platen""" .Values = yaxis .XValues = xaxis .Format.Fill.ForeColor.RGB = RGB(255, 0, 0) End With End With 

这里是微软的文档链接 ,谈论完全合格的嵌套块。