Class ConditionValue (Excel VBA)

The class ConditionValue represents how the shortest bar or longest bar is evaluated for a data bar conditional formatting rule. To use a ConditionValue class variable it first needs to be instantiated, for example


Dim cve as ConditionValue
Set cve = ActiveCell.FormatConditions(1).MaxPoint

Modify

Modifies how the longest bar or shortest bar is evaluated for a data bar conditional formatting rule.

The following table describes the acceptable threshold values for each type of evaluation.

Modify (newtype, newvalue)


ActiveCell.FormatConditions(1).MaxPoint.Modify newtype:=xlConditionValueAutomaticMax

Arguments

The following argument is required

newtype (XlConditionValueTypes) - Specifies how the shortest bar or longest bar is evaluated. The default value is xlConditionLowestValue for the shortest bar and xlConditionHighestValue for the longest bar.

Here you can find possible values for XlConditionValueTypes

Optional arguments

The following argument is optional

newvalue (Variant) - The value assigned to the shortest or longest data bar. Depending on the NewType argument, this can be a number or a formula that evaluates to a number.

Type

Returns one of the constants of the XlConditionValueTypes enumeration, which specifies how the threshold values for a data bar, color scale, or icon set conditional format are determined. Here you can find possible values for XlConditionValueTypes.


Dim xcvsType As XlConditionValueTypes
xcvsType = ActiveCell.FormatConditions(1).MaxPoint.Type

Value

Returns or sets the shortest bar or longest bar threshold value for a data bar conditional format. Read/write Variant.

You can set the value only if the Type property for the conditional format is set to one of the following XlConditionValueTypes constants: xlConditionValueNumber, xlConditionValuePercent, xlConditionValuePercentile, or xlConditionValueFormula. If the threshold type is a formula, you can set the formula as a String. The formula must return a single number.


Dim varValue As Variant
varValue = ActiveCell.FormatConditions(1).MaxPoint.Value