Databar Object Example

This example creates a data bar conditional formatting rule that sets the highest value in the specified range as the MaxPoint and the value in cell F14 as the MinPoint:

Sub CreateDatabar() Dim oDatabar As Databar 'Add a Data bar

Set oDatabar = Range("F6:F16").FormatConditions.AddDatabar 'Set the max and min parameters for the data bar 'Note the MinPoint for the databar is a value in cell F14 With oDatabar

.MaxPoint.Modify xlConditionValueHighestValue .MinPoint.Modify xlConditionValueNumber, "=$F$14" .BarColor.Color = 7039480 .ShowValue = True End With End Sub

0 0

Post a comment