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

I am importing data of variable length (rows) and never know the exact size.

How can I write a programme that in setting up the Pivot table identifies
the size of the data table in the same way that "currentregion" does for say
copy and paste.

I am told that dynamic range is the answer but dont know hoe to write syntax
to incorporate into the pivot element of the VBA programme.

Ta in advance for any help offerred


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Pivot Table & Dynamic data

You could use .current region in your code, too.

dim myPTRng as range
with worksheets("Sheet1")
set myptrng = .range("a1").currentregion
end with

Or if you know the last column (say W) and can pick out a column that always has
an entry (I used column A in my example):

dim myPTRng as range
with worksheets("Sheet1")
set myptrng = .range("a1:W" & .cells(.rows.count,"A").end(xlup).row)
end with

then later...

,sourcedata:=myptrng.address(external:=true), ...

If the data can change after you create the pivottable, you may want to look at
using a dynamic range. You can see some instructions at Debra Dalgleish's site:

http://www.contextures.com/xlNames01.html#Dynamic

Sophism wrote:

I am importing data of variable length (rows) and never know the exact size.

How can I write a programme that in setting up the Pivot table identifies
the size of the data table in the same way that "currentregion" does for say
copy and paste.

I am told that dynamic range is the answer but dont know hoe to write syntax
to incorporate into the pivot element of the VBA programme.

Ta in advance for any help offerred


--

Dave Peterson

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
use dynamic data source to make pivot table henry Excel Discussion (Misc queries) 0 July 15th 08 02:18 PM
vlookup data in a dynamic pivot table? MikeM Excel Worksheet Functions 4 January 2nd 06 10:00 PM
pivot table with dynamic base data bb Charts and Charting in Excel 2 June 13th 05 04:16 PM
Pivot table, dynamic data formula Excel GuRu Excel Discussion (Misc queries) 3 May 3rd 05 10:45 PM
Update Data Field in Pivot Table with Dynamic Excel Range ExcelMonkey[_97_] Excel Programming 1 March 3rd 04 08:16 PM


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