@dangelor What if I wanted to the the same function on sheet 2, but I wanted the action to be triggered from the action on sheet on. So when B2 on sheet 1 changes hide rows on both sheet 1 and sheet2.
I'm trying to hide and unhide rows based on the value of Column H. If H=1 hide, if H=2 unhide. H has a if formula so based on the value of B2 the value of H will change. the Hide function works but the unhide function does not. Below is my code and I have attached a sample worksheet as well.Code
Private Sub Worksheet_Calculate() Dim LastRow As Long, c As Range Application.EnableEvents = False LastRow = Cells(Cells.Rows.Count, "H").End(xlUp).Row On Error Resume Next For Each c In Range("H1:H" & LastRow) If c.Value = 1 Then c.EntireRow.Hidden = True ElseIf c.Value = 2 Then c.EntireRow.Hidden = False End If Next On Error GoTo 0 Application.EnableEvents = True End Sub