(Solved) – Un/Hide Rows base on cell change of two different cells Un/Hiding different parts of the sheet independently

(solved)-–-un/hide-rows-base-on-cell-change-of-two-different-cells-un/hiding-different-parts-of-the-sheet-independently

I have a very simple code that works very well to Un/Hide rows when change the cell value of S55. BUT I need a code but works exactly the same for two portions of my sheet independently.

I mean changing the first cell un/hide some rows at the beggining and on the other side changing another cell at the end of the sheet un/hide others rows differents of the one at the beggining.

here is the code.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim HideRows As Range, ViewRows As Range

If Intersect([s55], Target) Is Nothing Then Exit Sub

Select Case [s55].Value
    Case Is = 0
        Set HideRows = Rows("60:298")
        Set ViewRows = Nothing

End Select
On Error Resume Next
HideRows.Hidden = True
ViewRows.Hidden = False
End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *