demonfreak
New Member
- Joined
- Dec 11, 2016
- Messages
- 12
I've found this VBA code online that will insert a date in another cell when any value is entered in the target range.
What I'm wanting to do is the same thing but instead of any value I want a specific value.
I have a column "I" that will only be a "Y" or a "N". I want if the "I" column a "Y" is entered then put today's date. But if the "I" column is "N" or "Blank" then do nothing (no date). I'm having trouble figuring out how to do this.
What I'm wanting to do is the same thing but instead of any value I want a specific value.
I have a column "I" that will only be a "Y" or a "N". I want if the "I" column a "Y" is entered then put today's date. But if the "I" column is "N" or "Blank" then do nothing (no date). I'm having trouble figuring out how to do this.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim A As Range, B As Range, Inte As Range, r As Range
Set A = Range("A:A")
Set Inte = Intersect(A, Target)
If Inte Is Nothing Then Exit Sub
Application.EnableEvents = False
For Each r In Inte
If r.Offset(0, 1).Value = "" Then
r.Offset(0, 1).Value = Date
End If
Next r
Application.EnableEvents = True
End Sub