![]() |
PivotTable selection
Hi,
I've created a PivotTable using code and I can't seem to find a way to actually select it after it's done (hence, also display the PivotTable Field List) other than selecting a cell within my PivotTable. Is there a function somewhere that would select the newly created PivotTable no matter where it's residing on the sheet? Thanks, SC BTW, here's a sample of my code if it helps: Dim oPivot As PivotTable With ActiveWorkbook.PivotCaches.Add (SourceType:=xlExternal) .Connection = {...} 'CreatePivotTable parameters order: TableDestination, TableName, ReadData, DefaultVersion Set oPivot = .CreatePivotTable("[beh_gui.xls]Data! R3C2", "BEHPivotTable", , xlPivotTableVersion10) End With oPivot.AddDataField oPivot.PivotFields("Value"), "Total Value", xlSum What should come next? For the moment, I have this: oPivot.EnableFieldList = True ActiveWorkbook.Sheets(2).Activate ActiveWorkbook.Sheets(2).Range("B3").Select |
PivotTable selection
To select the pivotTable, including the page fields:
ActiveSheet.PivotTables("BEHPivotTable").TableRang e2.Select SC wrote: Hi, I've created a PivotTable using code and I can't seem to find a way to actually select it after it's done (hence, also display the PivotTable Field List) other than selecting a cell within my PivotTable. Is there a function somewhere that would select the newly created PivotTable no matter where it's residing on the sheet? Thanks, SC BTW, here's a sample of my code if it helps: Dim oPivot As PivotTable With ActiveWorkbook.PivotCaches.Add (SourceType:=xlExternal) .Connection = {...} 'CreatePivotTable parameters order: TableDestination, TableName, ReadData, DefaultVersion Set oPivot = .CreatePivotTable("[beh_gui.xls]Data! R3C2", "BEHPivotTable", , xlPivotTableVersion10) End With oPivot.AddDataField oPivot.PivotFields("Value"), "Total Value", xlSum What should come next? For the moment, I have this: oPivot.EnableFieldList = True ActiveWorkbook.Sheets(2).Activate ActiveWorkbook.Sheets(2).Range("B3").Select -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
All times are GMT +1. The time now is 10:27 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com