Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Macro fails to select pivotitems

I've got a macro that for a selected agency will find the city/state
associated with that agency and then chooses that state in a pivot table.

For some reason things are no longer working. The macro seems to choose the
state in the pivot table, but the pivot table then shows no data. If I
manually select a different state the pivot table will populate with data and
then I can manually re-select the correct state using the drop down menu and
it will also work. It just doesn't seem to work when I have the macro select
it.

Any ideas on what I'm doing wrong or how I can fix this?
It doesn't appear to be a trailing space issue, fwiw.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Macro fails to select pivotitems

You probably corrupted your pivot table using your method of assignment. I
have found it best to actually use the value of the pivotitem to make the
assignment. Try recreating the pivot table to get rid of the "corruption"
and then use somthing like
this example:

With sh.PivotTables("Project_View") _
..PivotFields("ITBGrp")
For Each pi In .PivotItems
If LCase(pi.Value) = LCase(Range("B9").Value) Then
..CurrentPage = pi.Value
End If
Next
End With

where I am setting the pagefield to the value in cell B9.

--
Regards,
Tom Ogilvy



"Allen" wrote:

I've got a macro that for a selected agency will find the city/state
associated with that agency and then chooses that state in a pivot table.

For some reason things are no longer working. The macro seems to choose the
state in the pivot table, but the pivot table then shows no data. If I
manually select a different state the pivot table will populate with data and
then I can manually re-select the correct state using the drop down menu and
it will also work. It just doesn't seem to work when I have the macro select
it.

Any ideas on what I'm doing wrong or how I can fix this?
It doesn't appear to be a trailing space issue, fwiw.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Macro fails to select pivotitems

On Jul 17, 7:54 am, Allen wrote:
I've got a macro that for a selected agency will find the city/state
associated with that agency and then chooses that state in a pivot table.

For some reason things are no longer working. The macro seems to choose the
state in the pivot table, but the pivot table then shows no data. If I
manually select a different state the pivot table will populate with data and
then I can manually re-select the correct state using the drop down menu and
it will also work. It just doesn't seem to work when I have the macro select
it.

Any ideas on what I'm doing wrong or how I can fix this?
It doesn't appear to be a trailing space issue, fwiw.


It is hard to tell what is wrong with something like this without
seeing the section of code that you think should be working. I do
this with several tables. I have pivot tables that cycle through all
the page fields and format the reports onto separate sheets.

Peter

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
Enumerating PivotItems collection fails to display duplicate values kirk Excel Programming 2 October 17th 06 09:01 AM
Select range fails Geoff Excel Programming 6 August 16th 05 06:53 AM
select method of range class fails mark kubicki Excel Programming 12 April 27th 05 02:37 PM
Select method of Range fails J West Excel Programming 1 June 7th 04 02:41 PM
Add PivotItems to PivotTable / Enabling - Disabling PivotItems Ole[_3_] Excel Programming 1 July 8th 03 03:24 PM


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