VBA code to hide or unhide rows based on a cell value

Posted by I AM L on Super User See other posts from Super User or by I AM L
Published on 2013-10-22T01:45:14Z Indexed on 2013/10/22 3:58 UTC
Read the original article Hit count: 177

Filed under:
|
|

Heres my code, but its not really doing anything, I dont see anything wrong with it:

Private Sub PG1(ByVal Target As Range)
        If .Range("E50").Value = "Passed" Then
            Rows("51").EntireRow.Hidden = True
                End If
        ElseIf Range("E50").Value = "Failed" Then
            Rows("51").EntireRow.Hidden = True
                End If
        End Sub

My intention is that when that specific cell in the previous row is set to "Passed" from the dropdown, then the below row would appear, if its a 'Failed" then it'll be hidden instead.

© Super User or respective owner

Related posts about microsoft-excel

Related posts about vba