Text in cell

  • Thread starter That's Confidential
  • Start date
T

That's Confidential

Me once again!

In cell A1, I have a drop down list with the options "Disposed" and
"Returned." Now, when either of these values are selected, in B1, I would
like today's date (the day's when the spreadsheet is being used date) to
appear.

Thanks once again people! You are all stars!
 
F

Frank Kabel

Hi
this could only be done with VBA 8using an event macro).
Put the following code in your worksheet module (note:
This won't work with Excel 97 as the worksheet_change
event is not triggered by a change of the drop-down
listbox. If you use Excel 97 you have to use a helper cell
referencing the drop down cell and use the
worksheet_calculate event):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Intersect(Range("A1"), Target) Is Nothing Then Exit Sub
With Target
If .Value <> "" Then
Application.EnableEvents = False
.Offset(0, 1).NumberFormat = "MM-DD-YYYY"
.Offset(0, 1).Value = Now
Else
.Offset(0, 1).ClearContents
End If
End With

errhandler:
Application.EnableEvents = True
End Sub
 
T

That's Confidential

How do I enter this code into my worksheet module? I'm not so good with
using VBAs

Thanks

PS: I have Excel 2000
 

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