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

Hi

I've written a macro to save myself the effort of creating a pivot table of my employer's purchases and want to build it into a monthly template.

The range used in my test workbook is:

ActiveWorkbook.PivotCaches.Create(SourceType:=xlDa tabase, SourceData:= _
"Amended Output Report!R1C1:R1440C14", Version:=xlPivotTableVersion14). _
CreatePivotTable TableDestination:="Pivot!R7C2", TableName:="PivotTable1", _
DefaultVersion:=xlPivotTableVersion14

However, I want to have the the final row of the selection as the penultimate used row on the 'Amended Output Report' sheet, so if there's 10 Rows, I want the last to be Row 9, and if 50 rows, it to be Row 49.

The columns will remain the same every month, and the destination for the Pivot won't change.

Please can anyone advise if it's possible to make the row selection dynamic - and, if so, how - or would I need to go in and amend the VB manually each month?

Any advice greatly appreciated!

Steve
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Dynamic range for Pivot-generating Macro

Hi Claus

That's excellent, thank you very much for that!

Steve
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
VBA Dynamic range in Pivot table jmon76[_5_] Excel Programming 0 May 25th 10 03:30 PM
DYNAMIC RANGE FOR PIVOT TABLE Simon Excel Programming 1 March 29th 10 09:45 AM
need help in my code on generating chart with dynamic range kiwis Excel Programming 3 June 1st 07 04:57 AM
Dynamic Pivot table range watkincm Excel Programming 3 October 24th 06 03:58 PM
Dynamic Range for Pivot Table Rob Excel Programming 1 June 20th 06 08:24 PM


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