Returns or sets a Double that represents the the group interval for a field. This property is interpreted based upon the current setting for the GroupOn property. The following table describes how this property is interpreted based on the current GroupOn setting. Read/write.
GroupOn setting | Meaning of GroupInterval |
---|---|
plGroupOnEachValue | Ignored. |
plGroupOnPrefixChars | Number of initial characters to use from each value. |
plGroupOnYears | Number of years in each group. |
plGroupOnQtrs | Number of quarters in each group. |
plGroupOnMonths | Number of months in each group. |
plGroupOnWeeks | Number of weeks in each group. |
plGroupOnDays | Number of days in each group. |
plGroupOnHours | Number of hours in each group. |
plGroupOnMinutes | Number of minutes in each group. |
plGroupOnSeconds | Number of seconds in each group. |
plGroupOnInterval | Numeric size of each group. |
expression.GroupInterval
expression Required. An expression that returns a PivotField object.
GroupInterval property as it applies to the GroupLevel and PageField objects.
Returns or sets a Double that represents the group interval. Read/write.
expression.GroupInterval
expression Required. An expression that returns one of the above objects.
Example
As it applies to the PivotField object.
This example groups the Age field of PivotTable1. Starting at age 15, a new group will be created for every five years until age 80. Then, the font, foreground, background, height and alignment of the resulting groups are formatted.
Sub AddGrouping()
Dim vwView
Dim ptConstants
Dim pfGroupedField
Set ptConstants = PivotTable1.Constants
' Set a variable to the active view of the PivotTable.
Set vwView = PivotTable1.ActiveView
' Set a variable to the Age field.
Set pfGroupedField = vwView.FieldSets("Age").Fields("Age")
' Set the GroupOn property so that the Age field will be
' grouped by the GroupInterval setting.
pfGroupedField.GroupOn = ptConstants.plGroupOnInterval
' Create a new grouping for every five years.
pfGroupedField.GroupInterval = 5
' Start the grouping at age 15.
pfGroupedField.GroupStart = 15
' End the grouping at age 80.
pfGroupedField.GroupEnd = 80
' Set the font for the field when it is grouped.
pfGroupedField.GroupedFont.Bold = True
' Set the foreground color for the field when it is grouped.
pfGroupedField.GroupedForeColor = "Black"
' Set the Background color for the field when it is grouped.
pfGroupedField.GroupedBackColor = "Blue"
' Set the height for the field when it is grouped.
pfGroupedField.GroupedHeight = 15
' Set the horizontal alignment for the field when it is grouped.
pfGroupedField.GroupedHAlignment = ptConstants.plHAlignRight
End Sub