ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Updated Field... (https://www.excelbanter.com/excel-discussion-misc-queries/51946-updated-field.html)

Chris

Updated Field...
 
If I have some text information in a cell and when that text changes, I want
to a date to get updated to today's date, how would I do that?

Example:
A1 contains text that reads "123456890TEST"
A2 is formatted as a date and if I changed the text above to "XYZ" A2 would
change to 10.24.05

Think of it like tracking in a way... If something changes in Cell1, update
Cell2 with today's date...

Bob Phillips

Updated Field...
 
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1:A100"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
.Offset(0, 1).Value = Format(Date, "dd mmm yyyy")
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Chris" wrote in message
...
If I have some text information in a cell and when that text changes, I

want
to a date to get updated to today's date, how would I do that?

Example:
A1 contains text that reads "123456890TEST"
A2 is formatted as a date and if I changed the text above to "XYZ" A2

would
change to 10.24.05

Think of it like tracking in a way... If something changes in Cell1,

update
Cell2 with today's date...





All times are GMT +1. The time now is 02:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com