PC Review


Reply
Thread Tools Rate Thread

Creating reports per Pivot Table PivotItem

 
 
=?Utf-8?B?Q2FuZHltYW4=?=
Guest
Posts: n/a
 
      3rd Apr 2007
I have a pivot table that cna be used to create reports per filtered PIVOT
ITEM.

my code jams when it trys to set the visible properties. Can you help?

Sub CreatePivotTabs()
'Create tabs per Pivot table
Dim x, y As Integer
Dim strLOB_NM, strHideLOB_NM As String

Sheets("Pivot Table").Select
With ActiveSheet.PivotTables("PivotTable1").PivotFields("LOB")
For x = 1 To .PivotItems.Count
For y = 1 To .PivotItems.Count
If y <> x Then
strHideLOB_NM = .PivotItems(y).Name
.PivotItems(strHideLOB_NM).Visible = False
Else
.PivotItems(y).Visible = True
strLOB_NM = .PivotItems(y).Name
End If
Next y
'create report and create on New tab named via strLOB_NM
' FormatAuditIssueTables Sheets("Pivot Table"), strLOB_NM

Sheets("Pivot Table").Select

Next x
End With
End Sub

Thank you so much!
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q2FuZHltYW4=?=
Guest
Posts: n/a
 
      4th Apr 2007
I modified the code to match what I could in the stmaents foud , but it still
jams on setting the visible to false. I want to loop through each 'LOB' and
create a report based on the table. Can anyone shed some light on this?


'Create tabs per Pivot table
Dim x, y As Integer
Dim strLOB_NM, strHideLOB_NM As String
Dim intASO As Integer

Sheets("Pivot Table").Select
With ActiveSheet.PivotTables("PivotTable1").PivotFields("LOB")
intASO = .AutoSortOrder
.AutoSort xlManual, "LOB"
For x = 1 To .PivotItems.Count
For y = 1 To .PivotItems.Count
If y <> x And .PivotItems(y).Visible = True Then
strHideLOB_NM = .PivotItems(y).Name
.PivotItems(strHideLOB_NM).Visible = False
'.PivotItems(y).Visible = False
ElseIf y = x Then
.PivotItems(y).Visible = True
strLOB_NM = .PivotItems(y).Name
End If
Next y
' FormatAuditIssueTables Sheets("Pivot Table"), strLOB_NM
Sheets("Pivot Table").Select
Next x
.AutoSort intASO, "LOB
End With
End Sub

"Candyman" wrote:

> I have a pivot table that cna be used to create reports per filtered PIVOT
> ITEM.
>
> my code jams when it trys to set the visible properties. Can you help?
>
> Sub CreatePivotTabs()
> 'Create tabs per Pivot table
> Dim x, y As Integer
> Dim strLOB_NM, strHideLOB_NM As String
>
> Sheets("Pivot Table").Select
> With ActiveSheet.PivotTables("PivotTable1").PivotFields("LOB")
> For x = 1 To .PivotItems.Count
> For y = 1 To .PivotItems.Count
> If y <> x Then
> strHideLOB_NM = .PivotItems(y).Name
> .PivotItems(strHideLOB_NM).Visible = False
> Else
> .PivotItems(y).Visible = True
> strLOB_NM = .PivotItems(y).Name
> End If
> Next y
> 'create report and create on New tab named via strLOB_NM
> ' FormatAuditIssueTables Sheets("Pivot Table"), strLOB_NM
>
> Sheets("Pivot Table").Select
>
> Next x
> End With
> End Sub
>
> Thank you so much!

 
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
Creating worksheet reports from a pivot table Donna Microsoft Excel Worksheet Functions 1 17th Aug 2009 01:55 AM
Help for vba to control the PivotItem in specific Field in Pivot Table by choose in inputbox Crystal Ng Microsoft Excel Programming 0 11th Jan 2008 03:07 AM
Pivot table reports cannot overlap another pivot table =?Utf-8?B?SmVhbg==?= Microsoft Excel Programming 1 6th Apr 2005 04:21 PM
Probs with creating multiple pivot charts from pivot table Retreatgal Microsoft Excel Charting 2 28th Jan 2004 02:51 AM
MS Excel - How can I summarize a table? Will Pivot Table Reports do this for me? hugh jass Microsoft Excel Programming 4 11th Sep 2003 12:02 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:32 AM.