I am not a VBA writer but I came across this code for hiding rows - however the vba needs to be re-ran if I make a change.
I have a down that that will pull in a new set of data for the past 2 years. Off to the right, I am summing the 2 years. What I would like, if that row is 0 I would like for it to be hidden.
If I select a new dropdown, then I would want other rows to be visible/hidden based on the information being pulled.
how do I get the vba to change when the data changes?
Thanks
Sub HideRows()
Application.ScreenUpdating = False
Application.Calculation = xlManual
For Each c In Range("AF8:AF34")
If c.Value = 0 Then Rows(c.Row).Hidden = True
Next
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
End Sub
I have a down that that will pull in a new set of data for the past 2 years. Off to the right, I am summing the 2 years. What I would like, if that row is 0 I would like for it to be hidden.
If I select a new dropdown, then I would want other rows to be visible/hidden based on the information being pulled.
how do I get the vba to change when the data changes?
Thanks
Sub HideRows()
Application.ScreenUpdating = False
Application.Calculation = xlManual
For Each c In Range("AF8:AF34")
If c.Value = 0 Then Rows(c.Row).Hidden = True
Next
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
End Sub