R
RefLib1978
Hi - I'm sorry if this is a duplicate question. I was unable to find the
answer in a search and thought that I would submit the question.
The question is two parts.
First, I have a table that uses A-I columns. The purpose of the table is to
track purchases. I would like to have a date automatically entered into
column A if I put information into B. Then to have a second date that enters
a date into H if I enter information into I. The date in A is for the day the
order was placed and the date in H is the date it arrived.
The second part is that I would like the dates to not change after their
created. I've been using a macro for column A:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count > 1 Then Exit Sub
If Not Intersect(Range("B:B"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
..Offset(0, -1).ClearContents
Else
With .Offset(0, -1)
..NumberFormat = "mm/dd/yyyy"
..Value = Now
End With
End If
Application.EnableEvents = True
End If
End With
End Sub
But I have found that the date changes if I do anything (including highlight
the text) of column B. Is it possible to prevent that from happening?
Thanks for the help.
C. Nichols
answer in a search and thought that I would submit the question.
The question is two parts.
First, I have a table that uses A-I columns. The purpose of the table is to
track purchases. I would like to have a date automatically entered into
column A if I put information into B. Then to have a second date that enters
a date into H if I enter information into I. The date in A is for the day the
order was placed and the date in H is the date it arrived.
The second part is that I would like the dates to not change after their
created. I've been using a macro for column A:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count > 1 Then Exit Sub
If Not Intersect(Range("B:B"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
..Offset(0, -1).ClearContents
Else
With .Offset(0, -1)
..NumberFormat = "mm/dd/yyyy"
..Value = Now
End With
End If
Application.EnableEvents = True
End If
End With
End Sub
But I have found that the date changes if I do anything (including highlight
the text) of column B. Is it possible to prevent that from happening?
Thanks for the help.
C. Nichols