PC Review


Reply
Thread Tools Rate Thread

Attn: Barb Reinhardt

 
 
Looping through
Guest
Posts: n/a
 
      3rd Jan 2008
Barb, I am reposting this today in an attempt to contact you. I am assuming
the discussion board does not monitor old strings. If your still out there, I
hope we can get back on this.

I added this code to my workbook and tried it. I get a run time error
1004 (Unable to set the _Default property of the Pivotitem class) when I
debug the line of code highlighted is "myPivotField.CurrentPage =
myPivotItem.Value"

thanks for your help to this point.
Peter

"Barb Reinhardt" wrote:

> Oops, try this
>
> Sub Filter_Rep()
> Dim aWS As Worksheet
> Dim newWS As Worksheet
> Dim myWB As Workbook
> Dim myWS As Worksheet
> Dim myPivotItem As PivotItem
>
> Set aWS = ActiveSheet
>
> For Each myPivotField In aWS.PivotTables("PivotTable1").PivotFields
> Debug.Print myPivotField.Name
> If myPivotField.Name = "Rep." Then
> For Each myPivotItem In myPivotField.PivotItems
> Debug.Print myPivotItem.Value
> If Not myPivotItem.Value = "(blank)" Then
> myPivotField.CurrentPage = myPivotItem.Value
> Set myWB = Workbooks.Add
> Set myWS = myWB.Worksheets(1)
> myWS.Range(aWS.UsedRange.Address) = aWS.UsedRange
> Debug.Print aWS.UsedRange.Address
> aWS.UsedRange.Copy
> myWS.PasteSpecial
> End If
> Next myPivotItem
> End If
> Next myPivotField
> End Sub
> --
> HTH,
> Barb Reinhardt


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Barb How do I get back to you... caseysmydog Microsoft Excel Programming 2 6th Nov 2008 02:56 PM
Barb...Don't know how to get back to you caseysmydog Microsoft Excel Programming 5 6th Nov 2008 01:52 PM
Barb...you helped & said come back caseysmydog Microsoft Excel Programming 2 5th Nov 2008 08:55 PM
for Toppers and Barb =?Utf-8?B?eW9kb2NoaQ==?= Microsoft Excel Worksheet Functions 3 25th Jul 2007 12:57 PM
Barb Reinhardt: HOW TO: Plot a Team Name .... =?Utf-8?B?S2V2aW4gTWNDYXJ0bmV5?= Microsoft Excel Charting 2 1st Dec 2004 01:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:32 PM.