View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Inputting Dates Formula?

First thanks for trying a macro solution. (many folks have "macrophobia").
To use W instead of B change:
Target.Offset(0, 1).Value = Date
into:
Target.Offset(0, 22).Value = Date

You see 1 is for B
2 is for C


etc.
--
Gary''s Student - gsnu201001


"Scott" wrote:

Gary,
Yes, this does work. However, how do I change the destination cell for the
date to appear on? For instance, what do I do if I want it to display in
Column W? How do I edit your code?



"Gary''s Student" wrote:

You could use an event macro. Say we want to record in column B the data
when entry is made in column A. Insert the following event macro in the
worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim A As Range
Set A = Range("A:A")
If Intersect(A, Target) Is Nothing Then Exit Sub
Application.EnableEvents = False
Target.Offset(0, 1).Value = Date
Application.EnableEvents = True
End Sub

Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm

--
Gary''s Student - gsnu201001


"Scott" wrote:

Is there anyway to input a date in a cell when data first appears in another
cell? For instance, if I entered data in cell A1, is there a way that B1
will record that date, but not change it the next day?

Thanks!