Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
SC SC is offline
external usenet poster
 
Posts: 2
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot Group that Selection error in PivotTable CherylS Excel Discussion (Misc queries) 1 June 16th 08 10:40 PM
Creating a PivotTable w/o selecting data in an existing PivotTable Damian Excel Discussion (Misc queries) 6 November 2nd 07 04:44 PM
Copy Selection - Transpose Selection - Delete Selection Uninvisible Excel Discussion (Misc queries) 2 October 23rd 07 04:18 PM
PivotTable selection Skip[_3_] Excel Programming 0 January 7th 04 08:46 PM
Dynamic Selection of Pivottable Drop Down Items Pat[_8_] Excel Programming 0 November 7th 03 10:01 PM


All times are GMT +1. The time now is 11:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"