Auto Hide Pivot Table Items

  • Thread starter Thread starter lpolliard
  • Start date Start date
L

lpolliard

Hi ya all...

I want to automatically hide line items in a pivot table base on a
comparision. Lets start with a simple pivot table of jobs and sales$.
Can someone help me with a macro which will select all jobs whose sales
are below a certain amount and hide these jobs automatically?

Thanks much...you guys rock!
 
'------------------------------------------------------
Sub test()
Dim StartRow As Long
Dim LastRow As Long
Dim ValueColumn As Integer
Dim CheckValue As Double
'------------------------------
CheckValue = 1000000
ValueColumn = 4
StartRow = 6
LastRow = ActiveSheet.Cells(65536, ValueColumn).End(xlUp).Row - 1
'-- main loop
For rw = StartRow To LastRow
If ActiveSheet.Cells(rw, ValueColumn).Value < CheckValue Then
ActiveSheet.Rows(rw).EntireRow.Hidden = True
End If
Next
End Sub
'-- eop ------------------------------------------------


Regards
BrianB
========================================================
 
Back
Top