Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Pivot Table Refresh - Auto insert row

Hey all,

Haven't been able to track this one down.

I have a report page with three pivot tables, one below the other. Is there
anyway to maintain their spacial relationship when they get updated? That is,
if new information is added in the source data, and pivottable 1 gets larger
(more rows) that data dumps over whatever is in those rows below. I would
like the refresh action to insert rows when necessary so that pivots 2 and 3
move down accordingly. Same for when data is removed from source data (less
important).

Any ideas?

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,979
Default Pivot Table Refresh - Auto insert row

There's no built-in way to accomplish this. You could programmatically
move the pivot tables that are below the one that's being refreshed,
refresh the upper pivot table, then move the lower pivot tables back,
below the new last row.

Dominic LeVasseur wrote:
I have a report page with three pivot tables, one below the other. Is there
anyway to maintain their spacial relationship when they get updated? That is,
if new information is added in the source data, and pivottable 1 gets larger
(more rows) that data dumps over whatever is in those rows below. I would
like the refresh action to insert rows when necessary so that pivots 2 and 3
move down accordingly. Same for when data is removed from source data (less
important).


--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Pivot Table Refresh - Auto insert row

Thanks Debra.

Do you know the VBA property for a pivot tables last used row?



"Debra Dalgleish" wrote:

There's no built-in way to accomplish this. You could programmatically
move the pivot tables that are below the one that's being refreshed,
refresh the upper pivot table, then move the lower pivot tables back,
below the new last row.

Dominic LeVasseur wrote:
I have a report page with three pivot tables, one below the other. Is there
anyway to maintain their spacial relationship when they get updated? That is,
if new information is added in the source data, and pivottable 1 gets larger
(more rows) that data dumps over whatever is in those rows below. I would
like the refresh action to insert rows when necessary so that pivots 2 and 3
move down accordingly. Same for when data is removed from source data (less
important).


--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Pivot Table Refresh - Auto insert row

For those interested, this is the code I came up with:

Private Sub Worksheet_Activate()
Dim pt2lastrow, pt1lastrow As Integer
Application.ScreenUpdating = False

ActiveSheet.PivotTables("PivotTable1").TableRange2 .Cut
ActiveSheet.Range("AA1").Activate
ActiveSheet.Paste

ActiveSheet.PivotTables("PivotTable3").TableRange2 .Cut
ActiveSheet.Range("BA1").Activate
ActiveSheet.Paste

ActiveSheet.PivotTables("PivotTable2").PivotCache. Refresh
pt2lastrow = Cells(Rows.Count, "A").End(xlUp).Row

ActiveSheet.PivotTables("PivotTable1").TableRange2 .Cut
ActiveSheet.Cells(pt2lastrow + 2, "A").Activate
ActiveSheet.Paste

ActiveSheet.PivotTables("PivotTable1").PivotCache. Refresh
pt1lastrow = Cells(Rows.Count, "A").End(xlUp).Row

ActiveSheet.PivotTables("PivotTable3").TableRange2 .Cut
ActiveSheet.Cells(pt1lastrow + 2, "A").Activate
ActiveSheet.Paste

ActiveSheet.PivotTables("PivotTable3").PivotCache. Refresh

Columns("A:C").EntireColumn.AutoFit
Range("A1").Activate

Application.ScreenUpdating = True
End Sub


"Dominic LeVasseur" wrote:

Thanks Debra.

Do you know the VBA property for a pivot tables last used row?



"Debra Dalgleish" wrote:

There's no built-in way to accomplish this. You could programmatically
move the pivot tables that are below the one that's being refreshed,
refresh the upper pivot table, then move the lower pivot tables back,
below the new last row.

Dominic LeVasseur wrote:
I have a report page with three pivot tables, one below the other. Is there
anyway to maintain their spacial relationship when they get updated? That is,
if new information is added in the source data, and pivottable 1 gets larger
(more rows) that data dumps over whatever is in those rows below. I would
like the refresh action to insert rows when necessary so that pivots 2 and 3
move down accordingly. Same for when data is removed from source data (less
important).


--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,979
Default Pivot Table Refresh - Auto insert row

Thanks for posting your solution. Another way to determine the last row
of a pivot table:

Sub test1()
Dim pt As PivotTable
Set pt = ActiveSheet.PivotTables("PivotTable3")
Debug.Print pt.TableRange2.Rows(pt.TableRange2.Rows.Count).Row
End Sub


Dominic LeVasseur wrote:
For those interested, this is the code I came up with:

Private Sub Worksheet_Activate()
Dim pt2lastrow, pt1lastrow As Integer
Application.ScreenUpdating = False

ActiveSheet.PivotTables("PivotTable1").TableRange2 .Cut
ActiveSheet.Range("AA1").Activate
ActiveSheet.Paste

ActiveSheet.PivotTables("PivotTable3").TableRange2 .Cut
ActiveSheet.Range("BA1").Activate
ActiveSheet.Paste

ActiveSheet.PivotTables("PivotTable2").PivotCache. Refresh
pt2lastrow = Cells(Rows.Count, "A").End(xlUp).Row

ActiveSheet.PivotTables("PivotTable1").TableRange2 .Cut
ActiveSheet.Cells(pt2lastrow + 2, "A").Activate
ActiveSheet.Paste

ActiveSheet.PivotTables("PivotTable1").PivotCache. Refresh
pt1lastrow = Cells(Rows.Count, "A").End(xlUp).Row

ActiveSheet.PivotTables("PivotTable3").TableRange2 .Cut
ActiveSheet.Cells(pt1lastrow + 2, "A").Activate
ActiveSheet.Paste

ActiveSheet.PivotTables("PivotTable3").PivotCache. Refresh

Columns("A:C").EntireColumn.AutoFit
Range("A1").Activate

Application.ScreenUpdating = True
End Sub


"Dominic LeVasseur" wrote:


Thanks Debra.

Do you know the VBA property for a pivot tables last used row?



"Debra Dalgleish" wrote:


There's no built-in way to accomplish this. You could programmatically
move the pivot tables that are below the one that's being refreshed,
refresh the upper pivot table, then move the lower pivot tables back,
below the new last row.

Dominic LeVasseur wrote:

I have a report page with three pivot tables, one below the other. Is there
anyway to maintain their spacial relationship when they get updated? That is,
if new information is added in the source data, and pivottable 1 gets larger
(more rows) that data dumps over whatever is in those rows below. I would
like the refresh action to insert rows when necessary so that pivots 2 and 3
move down accordingly. Same for when data is removed from source data (less
important).

--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html





--
Debra Dalgleish
Contextures
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
Sheet protection code conflicts with Pivot Table "auto refresh" KG Excel Discussion (Misc queries) 6 December 21st 05 11:16 PM
pivot table rmsterling Excel Discussion (Misc queries) 5 November 14th 05 04:40 PM
Change Data In Pivot Table John Calder New Users to Excel 1 July 7th 05 10:41 PM
Pivot Tables, Help? Adam Excel Discussion (Misc queries) 6 March 24th 05 02:35 PM
ability to auto file column(s) on a pivot table km Excel Worksheet Functions 1 December 20th 04 09:39 PM


All times are GMT +1. The time now is 09:56 PM.

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"