Insert a day on change of other cell
Hi
I am trying to get spreadsheet to input todays date into a cell if an other
cell has a Y char in there. Thanks to many of you and to Frank I found I can
use UDF and I took code from this site and modified it.
The problem is this. I need it to trigger if the user puts in "Y" or "y" and
to ignore anything else inc blancks and "n" or "N".
This is the code that I am using:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myCell As Range
If Intersect(Target, Range("J9:J109")) = "Y" Then
Application.EnableEvents = False
For Each myCell In Intersect(Target, Range("J9:J109"))
myCell.Offset(0, 4).Value = (Date)
Next myCell
Application.EnableEvents = True
End If
If Not Intersect(Target, Range("J9:J109")) < "y" Then
Application.EnableEvents = False
For Each myCell In Intersect(Target, Range("J9:J109"))
myCell.Offset(0, 4).Value = (Date)
Next myCell
Application.EnableEvents = True
End If
End Sub
I am sure there is better way in doing the IF statment to check for both cap
and lower Y's.
Help!
Thanks
|