Quantcast
Viewing all articles
Browse latest Browse all 5414

How to Run Macro when Refresh Report?

Hi,

 

We are using below Macro code to Hide and Unhide Rows in BPC report if a column value is 0 using a Button.
We want this code to run every time when we refresh the report instead of a Button.

 

Sub HideRows()
   
    Dim cell As Range
    For Each cell In Range("B1:B33")
        If Not IsEmpty(cell) Then
            If cell.Value = 0 Then
                cell.EntireRow.Hidden = Flase
            End If
        End If
    Next
   
    Dim cell1 As Range
    For Each cell1 In Range("B1:B33")
        If Not IsEmpty(cell1) Then
            If cell1.Value = 0 Then
                cell1.EntireRow.Hidden = True
            End If
        End If
    Next
End Sub

 

I tried using Function After_Refresh but didn't work.

Please suggest how to do it.

 

Thanks,

Anitha


Viewing all articles
Browse latest Browse all 5414

Trending Articles