I try to hide and unhide several rows on the conditions below.
I need this for 6 more same conditions on other row.
For now only the first condition is working.
Private Sub Worksheet_Change(ByVal Target As Range)
' Check1:
Dim KeyCells As Range
' The variable KeyCells contains the cells that will
' cause an alert when they are changed.
Set KeyCells = Range("A3")
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
= "yes" Then
' Display a message when one of the designated cells has been
' changed.
' Place your code here.
Rows("4:6").EntireRow.Hidden = True
ElseIf Not Application.Intersect(KeyCells, Range(Target.Address)) _
= "no" Then
Rows("4:6").EntireRow.Hidden = False
End If
Exit Sub
' Check2:
Dim Netkwaliteit As Range
' The variable Netkwaliteit contains the cells that will
' cause an alert when they are changed.
Set Netkwaliteit = Range("A8")
If Not Application.Intersect(Netkwaliteit, Range(Target.Address)) _
= "yes" Then
' Display a message when one of the designated cells has been
' changed.
' Place your code here.
Rows("20:30").EntireRow.Hidden = True
ElseIf Not Application.Intersect(Netkwaliteit, Range(Target.Address)) _
= "no" Then
Rows("20:30").EntireRow.Hidden = False
End If
End Sub
I need this for 6 more same conditions on other row.
For now only the first condition is working.
Private Sub Worksheet_Change(ByVal Target As Range)
' Check1:
Dim KeyCells As Range
' The variable KeyCells contains the cells that will
' cause an alert when they are changed.
Set KeyCells = Range("A3")
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
= "yes" Then
' Display a message when one of the designated cells has been
' changed.
' Place your code here.
Rows("4:6").EntireRow.Hidden = True
ElseIf Not Application.Intersect(KeyCells, Range(Target.Address)) _
= "no" Then
Rows("4:6").EntireRow.Hidden = False
End If
Exit Sub
' Check2:
Dim Netkwaliteit As Range
' The variable Netkwaliteit contains the cells that will
' cause an alert when they are changed.
Set Netkwaliteit = Range("A8")
If Not Application.Intersect(Netkwaliteit, Range(Target.Address)) _
= "yes" Then
' Display a message when one of the designated cells has been
' changed.
' Place your code here.
Rows("20:30").EntireRow.Hidden = True
ElseIf Not Application.Intersect(Netkwaliteit, Range(Target.Address)) _
= "no" Then
Rows("20:30").EntireRow.Hidden = False
End If
End Sub