Auto Hide Pivot Table Items

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!
 
B

BrianB

'------------------------------------------------------
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
========================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top