View Single Post
  #2   Report Post  
Ron de Bruin
 
Posts: n/a
Default

Hi

You can do it with the change event of the worksheet
This example will place the date/time in the C column if you change
a cell in the range B1:B20.

Place the code in the Sheet module

Right click on a sheet tab and choose view code
Paste the code there
Alt-Q to go back to Excel

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("B1:B20"), Target) Is Nothing Then
Target.Offset(0, 1).Value = Format(Now, "mm-dd-yy hh:mm:ss")
End If
End Sub

--
Regards Ron de Bruin
http://www.rondebruin.nl



wrote in message oups.com...
Hi. I have been searching for hours and haven't found a solution
yet... Here's my problem:

I have a Spreadsheet that is tracking vehicle fleet oil change
information. One of the fields is tracking vehicle mileage at an oil
change. What I want to do is automatically populate the next field
with the current date if someone types in a value in the oil change
column.

For example:

A B C
1 car mileage date
2 600 12345 03/15/2005
3 601 33333 01/23/2005

When someone types mileage of 12345 into B2 (for car 600), I want C2 to
auto populate with the current date (ie, 03/15/2005) and save that
date. I would like this date stored and only updated if someone
actually modifies the mileage data. As an example, vehicle 601 last
had an oil change on 01/23/2005 at 33333 miles.

Any pointers?