0
我正在嘗試編寫一個VBA腳本,它爲範圍添加了databar
條件格式。我已經寫了下面的代碼,但是,我不知道如何更改databar
的顏色,並提供了不同的界限。當我將minpoint
設置爲0時,它可以工作,但我無法將maxpoint
設置爲指定變量(設置爲鍵入integer
)。我哪裏錯了?格式化數據欄對象
Set bar = rangeTest.FormatConditions.AddDatabar
'assign max value + 1 for databar upper bound
maxValue = Application.WorksheetFunction.Max(rangeTest) + 1
With bar
.BarFillType = xlDataBarFillSolid
.BarColor = RGB(189, 215, 238) 'error thrown here (Object doesn't support this property)
End With
With rangeTest.FormatConditions(1)
.MinPoint.Modify newtype:=0 'xlConditionValueAutomaticMin
.MaxPoint.Modify newtype:=xlConditionValueAutomaticMax 'error thrown here (invalid procedure call)
End With