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

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

CraigM

Active Member
Joined
Feb 27, 2003
Messages
320
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.
 

ASLAMNOORI

New Member
Joined
Feb 16, 2014
Messages
20
What if I want today's date static in column M whenever I enter data in column H in the same row?
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,151,871
Messages
5,766,857
Members
425,382
Latest member
IronM

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
Top