declan harte
New Member
Hi,
I have a macro that starts when I select a product in cell b1. It hides any line of my income statement that has a zero (does not have any value for this month)
This is a very long and detailed income statement so the accounts are grouped into categories so I would also like the hide rows macro to be initiated when someone groups or ungroups the data.
Any help would be appreciated.
Thanks,
Declan
I have a macro that starts when I select a product in cell b1. It hides any line of my income statement that has a zero (does not have any value for this month)
This is a very long and detailed income statement so the accounts are grouped into categories so I would also like the hide rows macro to be initiated when someone groups or ungroups the data.
Any help would be appreciated.
Thanks,
Declan
Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$1" Then Hide_Rows
End Sub
Sub Hide_Rows()
Dim i As Long
Application.EnableEvents = False
For i = 11 To 750
Rows(i).Hidden = Range("B" & i).Value = 0
Next i
Application.EnableEvents = True
End Sub