AboveAverage 对象 (Excel)AboveAverage Object (Excel)

表示条件格式规则的高于平均值的视图。Represents an above average visual of a conditional formatting rule. 对某一区域或选定内容应用颜色或填充有助于您查看与其他单元格相关的单元格的值。Represents an above average visual of a conditional formatting rule. Applying a color or fill to a range or selection to help you see the value of a cells relative to other cells.

注释Remarks

所有条件格式设置对象均包含在 FormatConditions 集合对象中,它是 Range 集合的子集。All conditional formatting objects are contained within a FormatConditions collection object, which is a child of a Range collection. You can create an above average formatting rule by using either the Add or AddAboveAverage method of the FormatConditions collection. 可以使用 FormatConditions 集合的 AddAddAboveAverage 方法创建上述平均格式规则。All conditional formatting objects are contained within a FormatConditions collection object, which is a child of a Range collection. You can create an above average formatting rule by using either the Add or AddAboveAverage method of the FormatConditions collection.

示例Example

以下示例通过条件格式规则生成一个动态数据集并对高于平均值的值应用颜色。The following example builds a dynamic data set and applies color to the above average values through conditional formatting rules.

Sub AboveAverageCF() 
 
' Building data for Melanie 
 Range("A1").Value = "Name" 
 Range("B1").Value = "Number" 
 Range("A2").Value = "Melanie-1" 
 Range("A2").AutoFill Destination:=Range("A2:A26"), Type:=xlFillDefault 
 Range("B2:B26").FormulaArray = "=INT(RAND()*101)" 
 Range("B2:B26").Select 
 
' Applying Conditional Formatting to items above the average. Should appear green fill and dark green font. 
 Selection.FormatConditions.AddAboveAverage 
 Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority 
 Selection.FormatConditions(1).AboveBelow = xlAboveAverage 
 With Selection.FormatConditions(1).Font 
 .Color = -16752384 
 .TintAndShade = 0 
 End With 
 With Selection.FormatConditions(1).Interior 
 .PatternColorIndex = xlAutomatic 
 .Color = 13561798 
 .TintAndShade = 0 
 End With 
MsgBox "Added an Above Average Conditional Format to Melanie's data. Press F9 to update values.", vbInformation 
 
End Sub

方法Methods

名称Name
DeleteDelete
ModifyAppliesToRangeModifyAppliesToRange
SetFirstPrioritySetFirstPriority
SetLastPrioritySetLastPriority

属性Properties

名称Name
AboveBelowAboveBelow
应用程序Application
AppliesToAppliesTo
BordersBorders
CalcForCalcFor
CreatorCreator
FontFont
InteriorInterior
NumberFormatNumberFormat
NumStdDevNumStdDev
ParentParent
PriorityPriority
PTConditionPTCondition
ScopeTypeScopeType
StopIfTrueStopIfTrue
TypeType

另请参阅See also

Excel 对象模型引用Excel Object Model Reference