Automatic date entry

buffalo

Board Regular
Joined
Jun 19, 2003
Messages
183
Hi,

QUESTION 1
Suppose I am entering data manually in various columns.
In Column "Date", I would want to entry to be automatic.

So, I enter Tom under Name, then press Tab (or click on the cell under Date), Anytime I want to enter Date, it should give me the current date.

THen if the useer wishes he may just click on that date or he may type some other date in the cell.

QUESTION 2
Similarly, I would also want the same thing to happen when the user uses Data forms.

Any help appreciated.
thanks
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Q1, try this in the Sheet code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 5 And Target.Count = 1 Then 'Column 5, ie Column E
If Target.Value = "" Then Target.Value = Now()
End If
End Sub

This code works for column 5, and only if there is no current entry in the cell. You may want to alter in case there are any other cells in col 5 (E) that you do not wish to change, ie the top few rows. You can simply format the column for any date format you want.
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,249
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top