如何在VBA中处理散点图中的标记?
分类:Excel
Sub Add_colour_scale_to_scatter()
chart_name = "Chart 2"
Set my_chart = ActiveSheet.ChartObjects(chart_name).Chart
Set my_series = my_chart.FullSeriesCollection(1)
my_colour = RGB(0, 176, 80) 'RGB(146, 208, 80)
Debug.Print my_colour
For i = 1 To my_series.Points.Count
my_series.Points(i).Select
With Selection 'my_series.Points(i)
.MarkerForegroundColor = my_colour 'Border colour of the points
.MarkerBackgroundColor = my_colour 'Colour of the points themselves
.Format.Line.Weight = 0 'border of the point 0pt
.Format.Line.Visible = msoFalse 'border of the point not visible
.Format.Line.Transparency = 1 'border of the point is completely transparent
.Border.Color = my_colour 'colour of the line between points
.Border.LineStyle = xlLineStyleNone 'line between points is none. Others: 'xlContinuous 'continous line 'xlDot 'dotted line
.Format.Fill.Visible = msoTrue 'the point is visible
.Format.Fill.Solid 'the point has a solid fill
.Format.Fill.ForeColor.RGB = my_colour
.Format.Fill.Transparency = 0.3
.MarkerStyle = 8 'round points
.MarkerSize = 5 'size of the points
End With
If i Mod 100 = 0 Then
DoEvents
'Debug.Print i
Application.StatusBar = i & " of " & my_series.Points.Count
End If
Next i
MsgBox "done"
End Sub
from 如何在VBA中处理散点图中的标记?