Thread: Insert Date
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Insert Date

Set the Security level to low/medium in (Tools|Macro|Security). Right click
on the sheet tab and 'view code' and paste the below code OR launch VBE using
Alt+F11. Double click the sheet tab and paste the code..

Private Sub Worksheet_Change(ByVal Target As Range)
Dim lngRow as Long
If Target.Column = 1 And Target.Row < 11 Then
lngRow = WorksheetFunction.Match(Target.Value, Range("B1:B10"), 0)
If lngRow 0 Then Range("C" & lngRow) = Date
End If
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"art" wrote:

Hello all:

How can I use a formula to insert a date in a cell the last time something
was used.

I have in chart which I enter codes. For E.G. from A1:A10 I enter codes. And
in B1:B10 I have a list of all kinds of codes. I want the formula to enter a
date in C1:C10 the date the code was used.

So if I enter today in cell A1 the code 239, then in C5 which is next to B5
which contains the code "239" it should insert the date 5/10/09. And evrytime
I use it again it should insert the newer date.

Any help is appreciated.

Thanks.