code to refresh pivots and then hide rows

mecheet

Board Regular
Joined
Apr 21, 2010
Messages
117
Hi

I need some code that will refresh all pivot tables and then hide rows, but these rows with change depending on the refresh of the pivots.

Is there anyway this can be done.

the rows will always have grang total as the last row to be shown, there will be several per worksheet and several worksheets in the workbook.

Any help appreciated.

Thanks
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
After looking around i have found the below code which works, but i need this to stop at row 100, can anyone help with this?

Is there then away to apply this to all worksheets?


Code:
Sub HideRowsWithZero()
    Dim x  As Integer
    Dim CheckValue
    x = 1
    Range("A1").Activate
    Do Until x > ActiveSheet.UsedRange.Rows.Count
        CheckValue = ActiveCell.Offset(0, 1).Value
        If CheckValue = 0 Then
            ActiveCell.EntireRow.Hidden = True
        ElseIf CheckValue <> 0 And ActiveCell.EntireRow.Hidden = True Then
            ActiveCell.EntireRow.Hidden = False
        End If
        ActiveCell.Offset(1, 0).Activate
        x = x + 1
    Loop
    Range("A1").Activate
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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
Back
Top