Insert Date

A

art

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.
 
J

Jacob Skaria

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top