[英]Change color of data series in excel xyscatter chart
I'm trying to change the color of the data points in an excel chart but everything im trying unsuccessful. 我正在尝试更改excel图表中数据点的颜色,但所有尝试都未成功。
This is one method I tried, yet the points still appear blue: 这是我尝试的一种方法,但是这些点仍然显示为蓝色:
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
Here's another method I tried and still the data points appear blue: 这是我尝试过的另一种方法,但数据点仍显示为蓝色:
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)
This is only one segment of my code, I can supply additional areas if necessary. 这只是我的代码的一部分,如有必要,我可以提供其他区域。 Any help would be greatly appreciated. 任何帮助将不胜感激。
I believe the problem is with the nested With
blocks getting confused. 我相信问题在于嵌套的With
块变得混乱。 Here is one way to solve it and still use nested With
block: 这是解决它并仍然使用嵌套的With
块的一种方法:
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
Here is Microsoft's documentation link that talks about fully qualified nested With
blocks. 这是Microsoft的文档链接 ,该链接讨论完全合格的嵌套With
块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.