Private Sub Worksheet_Change(ByVal Target As Range)
Dim cont, dateB, dateD
Dim msgB As String, msgD As String
Dim tRng As Range
Set tRng = Union(Range("B8"), Range("B9"), Range("D6"), Range("D9"))
Application.EnableEvents = False
msgB = "Enter D9 date?"
msgD = "Enter B9 date?"
On Error GoTo ExitNow
If Not Intersect(Target, tRng) Is Nothing And Target.Value <> "" And Target.Count = 1 Then
Select Case Target.Address
Case "$B$8"
Range("D5") = WorksheetFunction.WorkDay(Range("B8"), 10)
Case "$B$9"
If Range("D9") = "" Then
cont = MsgBox(msgB, vbYesNo)
If cont = vbYes Then
dateB = Application.InputBox("Enter D9 Date")
Range("D9") = dateB
Else
Range("B7") = WorksheetFunction.WorkDay(Range("B6"), 15)
GoTo ExitNow
End If
End If
Case "$D$6"
If Range("D9") = "" Then
cont = MsgBox(msgB, vbYesNo)
If cont = vbYes Then
dateB = Application.InputBox("Enter D9 Date")
Range("D9") = dateB
Else
Range("D7") = WorksheetFunction.WorkDay(Range("D6"), 10)
GoTo ExitNow
End If
End If
Case "$D$9"
If Range("B9") = "" Then
cont = MsgBox(msgD, vbYesNo)
If cont = vbYes Then
dateD = Application.InputBox("Enter B9 Date")
Range("B9") = dateD
Else
Range("B7") = WorksheetFunction.WorkDay(Range("B6"), 15)
GoTo ExitNow
End If
End If
Case Else
GoTo ExitNow
End Select
End If
ExitNow:
Application.EnableEvents = True
End Sub