Top10-Objekt (Excel)Top10 object (Excel)
Stellt eine Visualisierung der Top-10-Werte einer bedingten Formatierungsregel dar.Represents a top ten visual of a conditional formatting rule. Durch das Anwenden einer Farbe auf einen Bereich können Sie den Wert einer Zelle relativ zu anderen Zellen anzeigen.Applying a color to a range helps you see the value of a cell relative to other cells.
BemerkungenRemarks
Alle bedingten Formatierungsobjekte sind in einem FormatConditions -Auflistungsobjekt enthalten, das ein untergeordnetes Element einer Range -Auflistung ist.All conditional formatting objects are contained within a FormatConditions collection object, which is a child of a Range collection.
Sie können eine Top 10-Formatierungsregel erstellen, indem Sie entweder die Add -oder die AddTop10 -Methode der FormatConditions -Auflistung verwenden.You can create a top 10 formatting rule by using either the Add or AddTop10 method of the FormatConditions collection.
BeispielExample
Im folgenden Beispiel wird ein dynamischer Datensatz erstellt und den Top-10-Werten mithilfe bedingter Formatierungsregeln eine Farbe zugewiesen.The following example builds a dynamic data set and applies color to the top 10 values through conditional formatting rules.
Sub Top10CF()
' Building data
Range("A1").Value = "Name"
Range("B1").Value = "Number"
Range("A2").Value = "Agent1"
Range("A2").AutoFill Destination:=Range("A2:A26"), Type:=xlFillDefault
Range("B2:B26").FormulaArray = "=INT(RAND()*101)"
Range("B2:B26").Select
' Applying Conditional Formatting Top 10
Selection.FormatConditions.AddTop10
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1)
.TopBottom = xlTop10Top
.Rank = 10
.Percent = False
End With
' Applying color fill
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 Top10 Conditional Format. Press F9 to update values.", vbInformation
End Sub
MethodenMethods
- DeleteDelete
- ModifyAppliesToRangeModifyAppliesToRange
- SetFirstPrioritySetFirstPriority
- SetLastPrioritySetLastPriority
EigenschaftenProperties
- ApplicationApplication
- AppliesToAppliesTo
- BordersBorders
- CalcForCalcFor
- CreatorCreator
- FontFont
- InteriorInterior
- NumberFormatNumberFormat
- ParentParent
- PercentPercent
- PriorityPriority
- PTConditionPTCondition
- RankRank
- ScopeTypeScopeType
- StopIfTrueStopIfTrue
- TopBottomTopBottom
- TypType
Siehe auchSee also
Support und FeedbackSupport and feedback
Haben Sie Fragen oder Feedback zu Office VBA oder zu dieser Dokumentation?Have questions or feedback about Office VBA or this documentation? Unter Office VBA-Support und Feedback finden Sie Hilfestellung zu den Möglichkeiten, wie Sie Support erhalten und Feedback abgeben können.Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.