Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
aw aw is offline
external usenet poster
 
Posts: 19
Default Range setting for pivot table

Just want to know the way to set the range property for creating pivot table
provide that the number of row will change by each time.

Eg. The following line R137, today may be 137 total number of row & may be
237 for tomorrow report.

If I just amend the range from R137 to R10000 (aim to cover all data), error
will appear when running the macro if the number of row changed by next time.



Selection.CurrentRegion.Select
ActiveWorkbook.Names.Add Name:="rangeT",
RefersToR1C1:="=aging_data!R11C1:R137C16"

--
aw
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Range setting for pivot table

Can you pick out a column that always has data in it if that row is used?

If yes, you could do something in code, but I think it would be easier to create
a dynamic name that adjusted when the data changed--then you could just refresh
the pivottable instead of rebuilding it.

Debra Dalgleish explains dynamic range names he
http://contextures.com/xlNames01.html#Dynamic

Insert|Name|define
Names in Workbook: RangeT
Refers to: =OFFSET('aging_data'!$A$1,0,0,COUNTA('aging_data'! $A:$A),16)

This expects that column A always has something in it if that row is used. If
you don't have a column that can be used to determine the last row, then this
formula won't work.

If you really wanted this in code, record one while you create the name and
you'll be set.




aw wrote:

Just want to know the way to set the range property for creating pivot table
provide that the number of row will change by each time.

Eg. The following line R137, today may be 137 total number of row & may be
237 for tomorrow report.

If I just amend the range from R137 to R10000 (aim to cover all data), error
will appear when running the macro if the number of row changed by next time.

Selection.CurrentRegion.Select
ActiveWorkbook.Names.Add Name:="rangeT",
RefersToR1C1:="=aging_data!R11C1:R137C16"

--
aw


--

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
setting range criteria in pivot table ela Excel Discussion (Misc queries) 2 November 27th 08 08:28 AM
setting up a pivot table via macro? SteveM Excel Discussion (Misc queries) 0 November 5th 08 11:01 PM
Changing a field setting in a pivot table The Rook[_2_] Excel Discussion (Misc queries) 3 September 5th 08 05:29 PM
Setting Range in Pivot Table Dhiraj Charts and Charting in Excel 1 August 15th 05 01:27 AM
Setting default pivot table field setting to "sum" Mr. Moose Excel Discussion (Misc queries) 2 December 21st 04 04:43 PM


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