B
Barry
I'm working on this worksheet and you folks have been wonderful in your
help.
Sometimes I accept your help without question but this time I need further
explanation..
Someone sent me this code which does the job but I think my next step
requires me to work with this same code and I only have a slight clue as to
what it means. If someone could explain what this code means in common terms
I would be greatly appreciative.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit
Application.EnableEvents = False
With Target
If Not Intersect(Target, Me.Range("A20:A23")) Is Nothing Then
If .Offset(0, 1).Value <> "" Then
If .Value > .Offset(0, 1).Value Then
MsgBox "Sorry, Invalid date!"
.Value = ""
.Offset(0, 2).Select
End If
End If
ElseIf Not Intersect(Target, Me.Range("B20:B23")) Is Nothing Then
If .Value <> "" Then
If .Value <= .Offset(0, -1).Value Then
MsgBox "Date must be later then Start Date!"
.Value = ""
.Offset(0, 1).Select
End If
End If
End If
End With
ws_exit:
Application.EnableEvents = True
End Sub
Thanks In Advance,
Barry
A copy of the worksheet can be downloaded from this address:
http://cjoint.com/?kut13HJGpY
My next step is to try and add code to evaluate the contents of cell B20 .
If B20 is greater than the 145th day of the year I would like to be able to
Set B20 to 145 and move the selected date to B21 with A21= 145 and so
forth...
help.
Sometimes I accept your help without question but this time I need further
explanation..
Someone sent me this code which does the job but I think my next step
requires me to work with this same code and I only have a slight clue as to
what it means. If someone could explain what this code means in common terms
I would be greatly appreciative.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit
Application.EnableEvents = False
With Target
If Not Intersect(Target, Me.Range("A20:A23")) Is Nothing Then
If .Offset(0, 1).Value <> "" Then
If .Value > .Offset(0, 1).Value Then
MsgBox "Sorry, Invalid date!"
.Value = ""
.Offset(0, 2).Select
End If
End If
ElseIf Not Intersect(Target, Me.Range("B20:B23")) Is Nothing Then
If .Value <> "" Then
If .Value <= .Offset(0, -1).Value Then
MsgBox "Date must be later then Start Date!"
.Value = ""
.Offset(0, 1).Select
End If
End If
End If
End With
ws_exit:
Application.EnableEvents = True
End Sub
Thanks In Advance,
Barry
A copy of the worksheet can be downloaded from this address:
http://cjoint.com/?kut13HJGpY
My next step is to try and add code to evaluate the contents of cell B20 .
If B20 is greater than the 145th day of the year I would like to be able to
Set B20 to 145 and move the selected date to B21 with A21= 145 and so
forth...