Hi Guys,
Have the following block of code below.
I have a line in red that I want to use to check that the end date is not earlier than the start date. If so, display the MsgBox advising that they can't enter data that way.
This currently isn't working very well (Ok, at all), any thoughts would be greatly appreciated.
-------------------------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Not Application.Intersect(Target, Range("D16:D100", "E16:E100")) Is Nothing Then
Call DateCheck
End If
If IsEmpty(Cells(Target.Row, "D")) = False And IsEmpty(Cells(Target.Row, "E")) = False Then
If Cells(Target.Row, "E") > Cells(Target.Row, "D") Then
Cells(Target.Row, "F") = (Cells(Target.Row, "E") - Cells(Target.Row, "D")) + 1
End If
Else: MsgBox "Sorry, End Date can't be before Start Date"
End If
End Sub
--------------------------------------
Cheers.
Have the following block of code below.
I have a line in red that I want to use to check that the end date is not earlier than the start date. If so, display the MsgBox advising that they can't enter data that way.
This currently isn't working very well (Ok, at all), any thoughts would be greatly appreciated.
-------------------------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Not Application.Intersect(Target, Range("D16:D100", "E16:E100")) Is Nothing Then
Call DateCheck
End If
If IsEmpty(Cells(Target.Row, "D")) = False And IsEmpty(Cells(Target.Row, "E")) = False Then
If Cells(Target.Row, "E") > Cells(Target.Row, "D") Then
Cells(Target.Row, "F") = (Cells(Target.Row, "E") - Cells(Target.Row, "D")) + 1
End If
Else: MsgBox "Sorry, End Date can't be before Start Date"
End If
End Sub
--------------------------------------
Cheers.