davidmburrows
New Member
- Joined
- May 2, 2002
- Messages
- 1
Could anyone please help?
Running Excel 97 SR-2 on windows NT4
I have a Pivot table with a number of pages
I have a Userform that creates a list of all the page values.
I then select from this list just the pages I want, and then print the selected pages.
The problem is:
I Have say 4 items in the selection list and I write each of these to the Pivot table page field in turn then print the page.
I will actually only get the first 3 pages.
When stepping through the VB code The Page variable has the correct value but the pivot table is typically one record out.
The very first record it tries to display is often a page from the table when originally saved and not necessarily in the list.
Here is the attached code
Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
ListP = UserForm1.ListBox2.List
If ListBox2.ListCount = 0 Then
MsgBox ("No Pages Selected! ")
Else:
For Each Proj In ListP
If IsNull(Proj) = False Then
Sheets("Report").PivotTables("PivotTable2").PivotFields
("Project").CurrentPage = (Proj)
Sheets("Report").PrintOut Copies:=1
End If
Next Proj
End If
Application.ScreenUpdating = True
End Sub
Many Thanks Dave
Running Excel 97 SR-2 on windows NT4
I have a Pivot table with a number of pages
I have a Userform that creates a list of all the page values.
I then select from this list just the pages I want, and then print the selected pages.
The problem is:
I Have say 4 items in the selection list and I write each of these to the Pivot table page field in turn then print the page.
I will actually only get the first 3 pages.
When stepping through the VB code The Page variable has the correct value but the pivot table is typically one record out.
The very first record it tries to display is often a page from the table when originally saved and not necessarily in the list.
Here is the attached code
Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
ListP = UserForm1.ListBox2.List
If ListBox2.ListCount = 0 Then
MsgBox ("No Pages Selected! ")
Else:
For Each Proj In ListP
If IsNull(Proj) = False Then
Sheets("Report").PivotTables("PivotTable2").PivotFields
("Project").CurrentPage = (Proj)
Sheets("Report").PrintOut Copies:=1
End If
Next Proj
End If
Application.ScreenUpdating = True
End Sub
Many Thanks Dave