Dear all,
I build the code below with great help of some forum users.
I don't know if it is possible, but is it possible avoid the following "user friendliness bug" in my workbook?
The unhidden rows based on the answers given in column 5 20, 26 and 33 are hidden when I change the input of column 5 row 2 in "PO RECEIVED" and / or "TARGET ADJUSTMENT" and then back into "MAR", "LOST", etc.
I know it is based on my command to hide row 5:47, 7:47 or 20:47.
Cheers,
Martin
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 5 And Target.Row = 2 Then
If Target.Value = "PO RECEIVED" Then
Rows("7:47").EntireRow.Hidden = True
End If
If Target.Value = "PO RECEIVED" Then
Rows("6").EntireRow.Hidden = False
End If
If Target.Value = "" Then
Rows("5:47").EntireRow.Hidden = True
End If
If Target.Value = "TARGET ADJUSTMENT" Then
Rows("6").EntireRow.Hidden = True
End If
If Target.Value = "TARGET ADJUSTMENT" Then
Rows("8").EntireRow.Hidden = False
End If
If Target.Value = "TARGET ADJUSTMENT" Then
Rows("20:47").EntireRow.Hidden = True
End If
If Target.Value = "PO IN BEFORE END OF THE MONTH" Then
Rows("6:19").EntireRow.Hidden = True
End If
If Target.Value = "PO IN BEFORE END OF THE MONTH" Then
Rows("20").EntireRow.Hidden = False
End If
If Target.Value = "PO IN BEFORE END OF THE MONTH" Then
Rows("23:26").EntireRow.Hidden = False
End If
If Target.Value = "PO IN BEFORE END OF THE MONTH" Then
Rows("28:33").EntireRow.Hidden = False
End If
If Target.Value = "PO IN BEFORE END OF THE QUARTER" Then
Rows("6:19").EntireRow.Hidden = True
End If
If Target.Value = "MAR" Then
Rows("6:19").EntireRow.Hidden = True
End If
If Target.Value = "LOST" Then
Rows("6:19").EntireRow.Hidden = True
End If
End If
If Target.Column = 5 And Target.Row = 8 Then
If Target.Value = "yes" Then
Rows("9:13").EntireRow.Hidden = True
End If
If Target.Value = "yes" Then
Rows("14:18").EntireRow.Hidden = False
End If
If Target.Value = "no" Then
Rows("9:13").EntireRow.Hidden = False
End If
If Target.Value = "no" Then
Rows("14:18").EntireRow.Hidden = True
End If
If Target.Value = "" Then
Rows("9:18").EntireRow.Hidden = True
End If
End If
If Target.Column = 5 And Target.Row = 20 Then
If Target.Value = "yes" Then
Rows("21:22").EntireRow.Hidden = True
End If
If Target.Value = "no" Then
Rows("21:22").EntireRow.Hidden = False
End If
If Target.Value = "" Then
Rows("21:22").EntireRow.Hidden = True
End If
End If
If Target.Column = 5 And Target.Row = 26 Then
If Target.Value = "yes" Then
Rows("27").EntireRow.Hidden = False
End If
If Target.Value = "no" Then
Rows("27").EntireRow.Hidden = True
End If
If Target.Value = "" Then
Rows("27").EntireRow.Hidden = True
End If
End If
If Target.Column = 5 And Target.Row = 33 Then
If Target.Value = "yes" Then
Rows("34:38").EntireRow.Hidden = True
End If
If Target.Value = "yes" Then
Rows("39:47").EntireRow.Hidden = False
End If
If Target.Value = "maybe" Then
Rows("34:47").EntireRow.Hidden = False
End If
If Target.Value = "no - next quarter" Then
Rows("37:39").EntireRow.Hidden = True
End If
If Target.Value = "no - next quarter" Then
Rows("34:36").EntireRow.Hidden = False
End If
If Target.Value = "no - next quarter" Then
Rows("40:47").EntireRow.Hidden = False
End If
If Target.Value = "no - will never receive" Then
Rows("34:38").EntireRow.Hidden = False
End If
If Target.Value = "no - will never receive" Then
Rows("39:47").EntireRow.Hidden = True
End If
If Target.Value = "" Then
Rows("34:47").EntireRow.Hidden = True
End If
End If
End Sub
Private Sub Calendar1_Click()
ActiveCell.Value = CDbl(Calendar1.Value)
ActiveCell.NumberFormat = "dd/mm/yyyy"
ActiveCell.Select
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("e6, I27, k42, k43, k44, k45, i47")) Is Nothing Then
Calendar1.Left = Target.Left + Target.Width - Calendar1.Width
Calendar1.Top = Target.Top + Target.Height
Calendar1.Visible = True
Calendar1.Value = Date
ElseIf Calendar1.Visible Then Calendar1.Visible = False
End If
End Sub
Bookmarks