Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Changing a pivot table field items to current database

I recorded a macro that included showing a pivot field item.
I have to run the macro on different databases that have a unique field
item. There is only one field name in the field in a drop down box. How can
I change the code below to show the field item that is established when
creating the pivot table not the one that was created when I recorded macro

ActiveSheet.PivotTables("PivotTable1").PivotFields ("facilityid")
..CurrentPage = "60172"

When I run the macro on the next database in the current page maybe 60173,
60174, ... My macro will get a run time error because it can not find the
60172 item.

Hope this makes some sense and someone can help.

Thanks in advance.

C. Pete Straman

--
Message posted via http://www.officekb.com
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Changing a pivot table field items to current database

Do you mean "ALL"

--
Regards,
Tom Ogilvy

"Pete Straman Straman via OfficeKB.com" wrote in
message ...
I recorded a macro that included showing a pivot field item.
I have to run the macro on different databases that have a unique field
item. There is only one field name in the field in a drop down box. How

can
I change the code below to show the field item that is established when
creating the pivot table not the one that was created when I recorded

macro

ActiveSheet.PivotTables("PivotTable1").PivotFields ("facilityid")
.CurrentPage = "60172"

When I run the macro on the next database in the current page maybe 60173,
60174, ... My macro will get a run time error because it can not find the
60172 item.

Hope this makes some sense and someone can help.

Thanks in advance.

C. Pete Straman

--
Message posted via http://www.officekb.com



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default Changing a pivot table field items to current database

If you need to show the item as selected in the dropdown:

With ActiveSheet.PivotTables(1).PivotFields("facilityid ")
.CurrentPage = .PivotItems(1).Value
End With


Pete Straman Straman via OfficeKB.com wrote:
I recorded a macro that included showing a pivot field item.
I have to run the macro on different databases that have a unique field
item. There is only one field name in the field in a drop down box. How can
I change the code below to show the field item that is established when
creating the pivot table not the one that was created when I recorded macro

ActiveSheet.PivotTables("PivotTable1").PivotFields ("facilityid")
.CurrentPage = "60172"

When I run the macro on the next database in the current page maybe 60173,
60174, ... My macro will get a run time error because it can not find the
60172 item.

Hope this makes some sense and someone can help.

Thanks in advance.

C. Pete Straman



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Changing a pivot table field items to current database

Yes,

I meant All. But to get it off of ALL to the value below it. I have code
now that fixes PT1 but not PT2.
Still working on it. See my reply to posting help.
Thank you in advance for anything you have to offer.

Pete

--
Message posted via http://www.officekb.com
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
Data Field Items deleted when unchecked in Pivot table Anant Excel Discussion (Misc queries) 1 October 23rd 07 01:15 PM
Pivot Table - Dragging multiple items into data field J@Y Excel Discussion (Misc queries) 1 January 12th 07 12:52 AM
Pivot Table - untick all items in row field DD1 Excel Discussion (Misc queries) 6 May 3rd 06 07:17 PM
Stepping through Pivot table page field items with VBA Tim Baker Excel Programming 3 November 26th 04 07:16 PM
Setting pivot table field (current page) to a chosen value Grant[_5_] Excel Programming 1 August 5th 04 02:24 AM


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