Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default select pivot table range

I use the code below to find the Total cell in a pivot table.
Issue:
When a cell in the range is active; Selection.End(xlDown).Select, sometimes
selects the active cell, and sometimes selects the Total cell at the bottom
of the range which is correct.

How do I force the select to the bottom of the Pivot Table?

Range("A19").Select
Selection.End(xlToRight).Select
Selection.End(xlDown).Select
Selection.ShowDetail = True

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default select pivot table range

Ah! Great question! It took me a while to figure out how to do this. Now,
I can share the answer with you.

Recorded Macro with Absolute Reference: Sheet1!R1C1:R30C10
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _
"Sheet1!R1C1:R30C10").CreatePivotTable TableDestination:="",
TableName:= _
"PivotTable1", DefaultVersion:=xlPivotTableVersion10

Recorded Macro with Absolute Reference changed to Relative Reference:
Sheets("Sheet1").Range("A1").CurrentRegion).
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _
Sheets("Sheet1").Range("A1").CurrentRegion).Create PivotTable _
TableDestination:=Sheets("Sheet2").Range("A3"),
TableName:="PivotTable1", _
DefaultVersion:=xlPivotTableVersion10


The second example will extend the Pivot Table range to the entire Pivot
Table, no matter whether the Pivot Table source data grows or shrinks over
time.


Regards,
Ryan---

--
RyGuy


"wynnyderpooh" wrote:

I use the code below to find the Total cell in a pivot table.
Issue:
When a cell in the range is active; Selection.End(xlDown).Select, sometimes
selects the active cell, and sometimes selects the Total cell at the bottom
of the range which is correct.

How do I force the select to the bottom of the Pivot Table?

Range("A19").Select
Selection.End(xlToRight).Select
Selection.End(xlDown).Select
Selection.ShowDetail = True

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
AUTO SELECT A RANGE FOR PIVOT TABLE SSJ New Users to Excel 1 December 24th 07 02:46 PM
Using cursor keys to select Pivot Table Source Data Range GuitrDad Excel Discussion (Misc queries) 0 September 12th 07 06:20 PM
select range for pivot table command Richard Excel Programming 3 October 23rd 06 06:14 PM
Pivot Table Select Range of Value pa32rt300t Excel Programming 0 March 15th 05 03:11 AM
How to select range of values in pivot table? RADO Excel Programming 1 October 9th 03 09:00 AM


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

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

About Us

"It's about Microsoft Excel"