Pivot table sorting

Code Chaser

New Member
Joined
Nov 23, 2016
Messages
8
I want to sort by a specific pivot table column, ultimately to copy and past the copied column into a new worksheet. This needs to happen for memo line A B and C. The column is called "Memo" and contains memo line A,B,C and N/A.

Problem: I want to deselect all pivot table items then make the variable MemoItem visible.

Could someone please explain to me what the FilterHelp variable is doing right now? and what do I need to do to solve my problem?

Thank you for the help.




'Include A, exclude B, C and N/A
Sheets("pivot by account and memo col").Select
With ActiveSheet.PivotTables("Recon Pivot").PivotFields("Memo")

Dim Memoitem As String
Dim i As Integer
For i = 1 To 3
If i = 1 Then
Memoitem = "A"
End If
If i = 2 Then
Memoitem = "B"
End If
If i = 3 Then
Memoitem = "C"
End If

Dim FilterHelp As Integer
On Error GoTo ErrorHandler2
.PivotItems(Memoitem).Visible = True
On Error GoTo 0
For FilterHelp = 2 To .PivotItems.Count
Sheets("pivot by account and memo col").Select
With ActiveSheet.PivotTables("Recon Pivot").PivotFields("Memo")
.PivotItems(FilterHelp-1).Visible = False 'Doesnt work right now, no idea why
On Error GoTo ErrorHandler2
.PivotItems(Memoitem).Visible = True
On Error GoTo 0
End With
Next FilterHelp
 

Some videos you may like

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Watch MrExcel Video

Forum statistics

Threads
1,122,514
Messages
5,596,612
Members
414,080
Latest member
penguin23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top