Hi all,
I have two worksheet changes that I am having trouble to combine so that the changes work at the same time. The two changes do affect the same cells, but one hides the whole row and one stops specific cells from being deleted.
Here are the two codes:
Can somebody please help me combine the two codes to work in cohesion?
Thanks,
I have two worksheet changes that I am having trouble to combine so that the changes work at the same time. The two changes do affect the same cells, but one hides the whole row and one stops specific cells from being deleted.
Here are the two codes:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("F28:J36,F45:J52,F58:J59")) Is Nothing Then Exit Sub
On Error GoTo ExitPoint
Application.EnableEvents = False
If Not IsDate(Target(1)) Then
Application.Undo
MsgBox " You can't delete contents from this cell." _
, vbCritical, "Message alert!"
End If
ExitPoint:
Application.EnableEvents = True
End Sub
Code:
Rows("28:36").Hidden = LCase(Range("B5").Value) = 1
Rows("45:52").Hidden = LCase(Range("B5").Value) = 1
Rows("58:59").Hidden = LCase(Range("B6").Value) = "no"
Can somebody please help me combine the two codes to work in cohesion?
Thanks,