[英]recorded vba code does not change legend colour in chart
下面的 VBA 代碼是我錄制宏來更改圖例中系列顏色時得到的。
當我運行它時,它不會改變顏色? 此外,有沒有一種方法可以指定系列,而不僅僅是系列 1、系列 2,而是我想指定蘋果、橘子等。
我的代碼如下:
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.Legend.Select
ActiveChart.Legend.LegendEntries(1).Select
With Selection.Format.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorText1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
.Solid
嘗試以下...
With ActiveSheet.ChartObjects("Chart 1").Chart
With .Legend.LegendEntries(1).LegendKey.Format.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorText1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
.Solid
End With
End With
希望這可以幫助!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.