Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing a Value in one cell after updating another 1

Status
Not open for further replies.

JJOHNS

MIS
Sep 12, 2001
171
US
I need to add a time stamp to an Excel spreadsheet. If someone changes one cell, I want another cell to change to today's date. Something like this:

A3 changes, causing A11 to =Now()

It should only change the value in that row.

Is there an easy way to do this?
 
Here's a routine...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = [inp].Address Then
[curdate].Value = Format(Now(), "Short Date")
End If
End Sub

Please note that this routine uses "range names" - "inp" assigned to cell A3, and "curdate" assigned to A11.

The use of range names is HIGHLY recommended (with all VBA), as it means any future changes (insertion/deletion of rows/columns, moving data, etc) won't require modification of the code.

Hope this helps.

Regards, ...Dale Watson dwatson@bsi.gov.mb.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top