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

I am trying to make a pivot table range dynamic. I have written the macros
to create the table using a static address - now I need the macro to
determine the range size of the underlying database...

Currently I use:
Set PTCache = ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, _
SourceData:=Range("A4:HP3014"))

The start point will always be cell A4 - but the last col and row needs to
be dynamic.
So far, the posts on this forum have not fixed it for me (or I have not
understood them correctly) - any suggestions...?
--
Mike Watkins
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Dynamic Pivot table range

My assumption is that you will always have something in each Cell in A...

Set PTCache = ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, _
SourceData:=Activesheet.Range(Activesheet.Range("H P4"),
activesheet.Cells(rows.count, "A").End(xlUp))

--
HTH...

Jim Thomlinson


"watkincm" wrote:

I am trying to make a pivot table range dynamic. I have written the macros
to create the table using a static address - now I need the macro to
determine the range size of the underlying database...

Currently I use:
Set PTCache = ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, _
SourceData:=Range("A4:HP3014"))

The start point will always be cell A4 - but the last col and row needs to
be dynamic.
So far, the posts on this forum have not fixed it for me (or I have not
understood them correctly) - any suggestions...?
--
Mike Watkins

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Dynamic Pivot table range

Wow... that was fast, Jim...!
Assumption about "A" is correct - there should always be something in there
I just tried it - this works - excellent - thanks!
Only question I have is that I am constantly extending the columns in the
spreadsheets so that "HP" may only be the last column for today... any
suggestions on how I could accommodate that variability...?

--
Mike Watkins


"Jim Thomlinson" wrote:

My assumption is that you will always have something in each Cell in A...

Set PTCache = ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, _
SourceData:=Activesheet.Range(Activesheet.Range("H P4"),
activesheet.Cells(rows.count, "A").End(xlUp))

--
HTH...

Jim Thomlinson


"watkincm" wrote:

I am trying to make a pivot table range dynamic. I have written the macros
to create the table using a static address - now I need the macro to
determine the range size of the underlying database...

Currently I use:
Set PTCache = ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, _
SourceData:=Range("A4:HP3014"))

The start point will always be cell A4 - but the last col and row needs to
be dynamic.
So far, the posts on this forum have not fixed it for me (or I have not
understood them correctly) - any suggestions...?
--
Mike Watkins

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Dynamic Pivot table range

Just trying to give an idea (not tried the code)

Maybe something like

Set PTCache = ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, _
SourceData:=Activesheet.Range(Activesheet.Cells(co lumns.count,"IV").End(xlLeft))

could help?

Martin
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
Dynamic range in Pivot table Wanna Learn Excel Discussion (Misc queries) 4 July 2nd 07 08:08 PM
Using dynamic range to create pivot table cursednomore Excel Discussion (Misc queries) 5 March 12th 07 02:40 PM
Dynamic Range in a Pivot Table Chris C Excel Discussion (Misc queries) 0 June 27th 06 06:11 PM
Dynamic Range for Pivot Table Rob Excel Programming 1 June 20th 06 08:24 PM
Refreshing a Pivot Table from a dynamic range matpj[_4_] Excel Programming 2 October 20th 05 03:19 PM


All times are GMT +1. The time now is 04:49 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"