當執行VBA命令時,我的數據欄看起來很好(可靠)。但是,保存文件並重新打開後,數據欄會自動更改爲漸變。我如何避免這種情況?如何在Excel VBA中將純色應用於數據欄?
之前保存和重新打開文件:
保存和重新打開文件後:
這是我使用的代碼:
Dim DB As Databar
Set DB = Range("K2:K10").FormatConditions.AddDatabar
With DB
.BarFillType = xlDataBarSolid
.BarBorder.Type = xlDataBarBorderSolid
With .BarBorder.Color
.Color = 15698432
End With
With .BarColor
.Color = 15698432
.TintAndShade = 0
End With
End With
With DB.BarColor
.Color = 15698432
.TintAndShade = 0
End With
With Range("K2:K10").FormatConditions(1)
.MinPoint.Modify newtype:=xlConditionValueAutomaticMin
.MaxPoint.Modify newtype:=xlConditionValueAutomaticMax
End With
如果vba代碼成功運行,我不認爲這是VBA的問題。我建議編輯添加'excel'和'bar-chart'標籤,以查看是否可以從更廣泛的excel用戶羣中獲得更多幫助。但是,它似乎並不是一個VBA問題。 – Chrismas007