![]() |
Return Rows of Selected Range in a Pivot
I'm trying to figure out how to return the rows of a selected range in a
pivot table. For Example, when I record a macro to select all 2001s in my pivot table, I get the following code: ActiveSheet.PivotTables("PivotTable1").PivotSelect "'2001'", xlDataAndLabel, _ True I'm trying to return the rows of all the selected items, so that I could set the rows of these items to a certain height, but cant come up with anything. Any help would be greatly appreciated. Thanks, Magnivy |
Return Rows of Selected Range in a Pivot
Hi,
The selected range is given by: Dim rg as Range set rg=Selection. The full rows are then given by: set rg= Selection.EntireRow and resizing would be : rg.RowHeight = ... -- Regards, Sébastien <http://www.ondemandanalysis.com <http://www.ready-reports.com "Magnivy" wrote: I'm trying to figure out how to return the rows of a selected range in a pivot table. For Example, when I record a macro to select all 2001s in my pivot table, I get the following code: ActiveSheet.PivotTables("PivotTable1").PivotSelect "'2001'", xlDataAndLabel, _ True I'm trying to return the rows of all the selected items, so that I could set the rows of these items to a certain height, but cant come up with anything. Any help would be greatly appreciated. Thanks, Magnivy |
Return Rows of Selected Range in a Pivot
Hey Sebastien,
Thanks for the reply. I tried the following code. dim rng as range set rng = ActiveSheet.PivotTables("PivotTable1").PivotSelect "'2001'", xlDataAndLabel, True and got an error. I cant think of a way to make it work. Magnivy "sebastienm" wrote: Hi, The selected range is given by: Dim rg as Range set rg=Selection. The full rows are then given by: set rg= Selection.EntireRow and resizing would be : rg.RowHeight = ... -- Regards, Sébastien <http://www.ondemandanalysis.com <http://www.ready-reports.com "Magnivy" wrote: I'm trying to figure out how to return the rows of a selected range in a pivot table. For Example, when I record a macro to select all 2001s in my pivot table, I get the following code: ActiveSheet.PivotTables("PivotTable1").PivotSelect "'2001'", xlDataAndLabel, _ True I'm trying to return the rows of all the selected items, so that I could set the rows of these items to a certain height, but cant come up with anything. Any help would be greatly appreciated. Thanks, Magnivy |
Return Rows of Selected Range in a Pivot
Got it! I could just use:
ActiveSheet.PivotTables("PivotTable1").PivotSelect "'2001'", xlDataAndLabel, True Selection.Rowheight Cant believe i didnt think of it before. "sebastienm" wrote: Hi, The selected range is given by: Dim rg as Range set rg=Selection. The full rows are then given by: set rg= Selection.EntireRow and resizing would be : rg.RowHeight = ... -- Regards, Sébastien <http://www.ondemandanalysis.com <http://www.ready-reports.com "Magnivy" wrote: I'm trying to figure out how to return the rows of a selected range in a pivot table. For Example, when I record a macro to select all 2001s in my pivot table, I get the following code: ActiveSheet.PivotTables("PivotTable1").PivotSelect "'2001'", xlDataAndLabel, _ True I'm trying to return the rows of all the selected items, so that I could set the rows of these items to a certain height, but cant come up with anything. Any help would be greatly appreciated. Thanks, Magnivy |
Return Rows of Selected Range in a Pivot
Yes, that would work !
(I couldn't remember whether or not the '.EntireRow' part was necessary.) -- Regards, Sébastien <http://www.ondemandanalysis.com <http://www.ready-reports.com "Magnivy" wrote: Got it! I could just use: ActiveSheet.PivotTables("PivotTable1").PivotSelect "'2001'", xlDataAndLabel, True Selection.Rowheight Cant believe i didnt think of it before. "sebastienm" wrote: Hi, The selected range is given by: Dim rg as Range set rg=Selection. The full rows are then given by: set rg= Selection.EntireRow and resizing would be : rg.RowHeight = ... -- Regards, Sébastien <http://www.ondemandanalysis.com <http://www.ready-reports.com "Magnivy" wrote: I'm trying to figure out how to return the rows of a selected range in a pivot table. For Example, when I record a macro to select all 2001s in my pivot table, I get the following code: ActiveSheet.PivotTables("PivotTable1").PivotSelect "'2001'", xlDataAndLabel, _ True I'm trying to return the rows of all the selected items, so that I could set the rows of these items to a certain height, but cant come up with anything. Any help would be greatly appreciated. Thanks, Magnivy |
All times are GMT +1. The time now is 06:27 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com