我想從 VBA 中的散點圖中洗掉標記,但我不知道該怎么做。我已經用谷歌搜索了一段時間,也使用了宏記錄器,但這些建議似乎都不起作用(還在代碼中包含了我的試用解決方案)。
Sub RekFiguur()
Mod_berekening.clearShape "UGT - moment", "B7:T19"
Dim wb As Workbook: Set wb = ThisWorkbook
Dim sht As Worksheet: Set sht = wb.Sheets("UGT - moment")
Dim sh As Shape
Dim chartObj As ChartObject
Dim chartSheet As Chart
Dim activeRow As Integer
Set chartObj = sht.ChartObjects.Add(Top:=80, Left:=20, Width:=240, Height:=150)
With chartObj.Chart
.ChartType = xlXYScatterLines
.HasLegend = False
.Parent.Name = "UGT-rek"
'Draw strain for concrete
.SeriesCollection.NewSeries
With .SeriesCollection(1)
.Name = "UGT-beton-rek"
.xValues = sht.Range("$AA$9:$AA$15")
.Values = sht.Range("$AE$9:$AE$15")
'.MarkerStyle = xlMarkerStyleNone 'No response
'.MarkerStyle = -4142 'No response
'.Format.Fill.Visible = msoFalse 'Removes only fill
'.Format.Line.Visible = msoFalse 'Does remove the marker but cant edit line anymore
.Format.Line.Weight = 1
.Format.Line.DashStyle = msoLineSolid
.Format.Line.ForeColor.RGB = RGB(0, 0, 0)
End With
.HasTitle = True
.HasTitle = False
'Some more irrelevant code for the chart I left out
end with
請參閱下面的結果,遺憾的是帶有標記。奇怪的是,直線是用代碼的精確副本制作的,但只有兩個資料點,并且這些標記被很好地洗掉了,我對此一無所知..

提前致謝。請客氣一點,如果您需要更多資訊,我會很樂意澄清
請參閱上面的代碼。我還嘗試了https://stackoverflow.com/questions/45429026/setting-line-on-xy-scatter-without-have-a-marker-line的解決方案,但這對我也沒有幫助
uj5u.com熱心網友回復:
改變
.ChartType = xlXYScatterLines
到
.ChartType = xlXYScatterLinesNoMarkers
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/447207.html
上一篇:在Excel中過濾文本和數字陣列
