Danielle22103
New Member
- Joined
- Dec 15, 2005
- Messages
- 13
Hi there
I have a simple code that hides rows when either W or S is selected in a cell ("H19"). I want the code to disable after a selection is made so the application.goto does not activate every time i populate a cell, however code should be activated again when the cell ("H19") contents is changed at any time. I know i should use the enable event in this code however it doesn't reactivate my code when changed more than once.
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("H19").Value = "W" Then
Range("20:150,157:302").Select
Selection.EntireRow.Hidden = True
Range("151:156").Select
Selection.EntireRow.Hidden = False
Application.Goto Range("H153")
ElseIf Range("H19").Value = "S" Then
Range("151:302").Select
Selection.EntireRow.Hidden = True
Range("20:25").Select
Selection.EntireRow.Hidden = False
Application.Goto Range("H22")
End If
End Sub
I have a simple code that hides rows when either W or S is selected in a cell ("H19"). I want the code to disable after a selection is made so the application.goto does not activate every time i populate a cell, however code should be activated again when the cell ("H19") contents is changed at any time. I know i should use the enable event in this code however it doesn't reactivate my code when changed more than once.
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("H19").Value = "W" Then
Range("20:150,157:302").Select
Selection.EntireRow.Hidden = True
Range("151:156").Select
Selection.EntireRow.Hidden = False
Application.Goto Range("H153")
ElseIf Range("H19").Value = "S" Then
Range("151:302").Select
Selection.EntireRow.Hidden = True
Range("20:25").Select
Selection.EntireRow.Hidden = False
Application.Goto Range("H22")
End If
End Sub