need format help

B

boltman17

I have a rather large spreadsheet in excel 2000. I've created an
empty column (K) next to a column that contains numeric data (L).
How can I get excel to place the current date in column k when i
change the numeric data in column L. Obviously I am over my head
here, and any help you guys can give will be greatly appreciated.

You can reply to the group, or e-mail me @ (e-mail address removed).

Thanks in advance for your help!!!!!!!!!!
 
F

Frank Kabel

Hi

based on code Dave Peterson posted some days ago you can use the
following VBA code:
It will insert the current date in column K if something is entered in
column L. If column L is deleted the date in column K is also deleted

To insert this code rightclick on the worksheet's tab and paste in this
code.

Some links for VBA / worksheet events instructions
http://www.mvps.org/dmcritchie/excel/getstarted.htm
http://www.cpearson.com/excel/events.htm

HTH
Frank
-------------------


Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("L1:L9")) Is Nothing Then Exit Sub
On Error GoTo errHandler:
Application.EnableEvents = False
With Me.Cells(Target.Row, "K")
If Target.Value = "" Then
'they've emptied the cell
.ClearContents
Else
.Value = Date
.NumberFormat = "mm/dd/yyyy"
End If
End With

errHandler:
Application.EnableEvents = True
End Sub
 

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