共用方式為


ConditionValue 物件 (Excel)

代表資料橫條設定格式化條件規則的最短或最長長條評估方式。

註解

ConditionValue 物件會使用 DataBar 物件的 MaxPointMinPoint 屬性來傳回。

您可以使用 Modify 方法變更評估類型的預設值 (最短長條為最低的值,而最長長條則為最高的值)。

範例

下列範例會建立資料範圍,然後將資料長條套用到該範圍。 您會注意到,由於範圍內有極低和極高的值,因此中間值具有相似長度的資料列。 為了釐清中間值的意義,此範例程式碼會使用 ConditionValue 物件來變更閾值求得百分位數的求值方式。

Sub CreateDataBarCF() 
 
 Dim cfDataBar As DataBar 
 
 'Create a range of data with a couple of extreme values 
 With ActiveSheet 
 .Range("D1") = 1 
 .Range("D2") = 45 
 .Range("D3") = 50 
 .Range("D2:D3").AutoFill Destination:=Range("D2:D8") 
 .Range("D9") = 500 
 End With 
 
 Range("D1:D9").Select 
 
 'Create a data bar with default behavior 
 Set cfDataBar = Selection.FormatConditions.AddDatabar 
 MsgBox "Because of the extreme values, middle data bars are very similar" 
 
 'The MinPoint and MaxPoint properties return a ConditionValue object 
 'which you can use to change threshold parameters 
 cfDataBar.MinPoint.Modify newtype:=xlConditionValuePercentile, _ 
 newvalue:=5 
 cfDataBar.MaxPoint.Modify newtype:=xlConditionValuePercentile, _ 
 newvalue:=75 
 
End Sub

方法

屬性

另請參閱

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應