Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

Excel VBA Macros - Hide/UnHide Cells

$
0
0

I am tyring to create macro that will hide cells depending on what data is in the cell. I am currently using this and it is working but I want to be able to use 2 or more as I have different cells that I want hidden depending on what is entered into other cells.

Private Sub Worksheet_Change(ByVal Target As Range)

    If Range("F5") = "Don't Show" Then

        Rows("8:9").EntireRow.Hidden = True

    Else

        Rows("8:9").EntireRow.Hidden = False

    End If

End Sub

But I also want this as well. How can I add them together?

Private Sub Worksheet_Change(ByVal Target As Range)

    If Range("F9") = "Don't Show" Then

        Rows("8:9").EntireRow.Hidden = True

    Else

        Rows("8:9").EntireRow.Hidden = False

    End If

End Sub

Thanks


Viewing all articles
Browse latest Browse all 11829

Trending Articles