I am new to vba and have been searching for a way to automatically hide rows based on the result of a formula that returns either Y or N. The following code is what I have found but it only works if I enter Y or N. What do I need to change in order to make it work with a formula result rather than a manual entry? Any help would be appreciated.
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("M39").Value = "N" Then
Rows("1:32").EntireRow.Hidden = True
ElseIf Range("M39").Value = "Y" Then
Rows("1:32").EntireRow.Hidden = False
End If
End Sub
Bookmarks