Laurence D
New Member
- Joined
- Sep 14, 2016
- Messages
- 31
Hi,
I am wanting some help to refine this date private sub code. Could somebody please help me include another step so that this sub will only perform if the range in I:L has got data in the cells. Currently it will perform if I put data in the L column. It needs to be similar to an AND approach (i.e. if any of the four cells are empty then exit sub etc.).
Thanks Laurence
I am wanting some help to refine this date private sub code. Could somebody please help me include another step so that this sub will only perform if the range in I:L has got data in the cells. Currently it will perform if I put data in the L column. It needs to be similar to an AND approach (i.e. if any of the four cells are empty then exit sub etc.).
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
Dim A As Range, Inte As Range, r As Range
Set A = Range("L:L")
Set Inte = Intersect(A, Target)
If Inte Is Nothing Then Exit Sub
Application.EnableEvents = False
For Each r In Inte
If Inte Is Nothing Then
Exit Sub
End If
If r.Offset(0, 1).Value = "" Then
r.Offset(0, 1).Value = Date
End If
Next r
Application.EnableEvents = True
End Sub
Thanks Laurence