ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Insert Date (https://www.excelbanter.com/excel-worksheet-functions/230427-insert-date.html)

Art

Insert Date
 
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.

Jacob Skaria

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.



All times are GMT +1. The time now is 11:15 AM.

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