G
Geoff
Hi
I have the following code, which selects the range containing all the labels
of the row field "Combination" in the pivot table "Combinations". It then
sets the value of lngRowStart as the row number of the active cell - this
should be the top (i.e. first) of the labels in this range.
ActiveSheet.PivotTables("Combinations").PivotSelect "Combination[All]",
xlLabelOnly
lngRowStart = ActiveCell.Row
Do While ActiveCell.Value <> ""
lngRowEnd = ActiveCell.Row
ActiveCell.Offset(1, 0).Activate
Loop
The problem is that frequently the top of the range is not selected.
Sometimes the active cell is the bottom (i.e. last) of the labels in the
range, meaning that the lngRowStart is assigned the same value as lngRowEnd
(not ideal in the context of this macro).
Can anyone suggest either an alternative way to get the top and bottom row
numbers of this range, or an alternative argument for the PivotSelect method
to specify that the top cell has to be active in the selection?
Thanks
I have the following code, which selects the range containing all the labels
of the row field "Combination" in the pivot table "Combinations". It then
sets the value of lngRowStart as the row number of the active cell - this
should be the top (i.e. first) of the labels in this range.
ActiveSheet.PivotTables("Combinations").PivotSelect "Combination[All]",
xlLabelOnly
lngRowStart = ActiveCell.Row
Do While ActiveCell.Value <> ""
lngRowEnd = ActiveCell.Row
ActiveCell.Offset(1, 0).Activate
Loop
The problem is that frequently the top of the range is not selected.
Sometimes the active cell is the bottom (i.e. last) of the labels in the
range, meaning that the lngRowStart is assigned the same value as lngRowEnd
(not ideal in the context of this macro).
Can anyone suggest either an alternative way to get the top and bottom row
numbers of this range, or an alternative argument for the PivotSelect method
to specify that the top cell has to be active in the selection?
Thanks