ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Data Form (https://www.excelbanter.com/excel-discussion-misc-queries/163153-data-form.html)

Steve

Data Form
 
Can a Data Form field be automatically populated with current date? Tying to
avoid having users type in this field for every row entered.

Bernie Deitrick

Data Form
 
Steve,

Copy the code below, right click the sheet tab, select "View Code" and paste the code into the
window that appears.

This code will put the date into column A of any row where data is entered IF that cell is currently
blank.

HTH,
Bernie
MS Excel MVP

Private Sub Worksheet_Change(ByVal Target As Range)
If Cells(Target.Row, 1).Value < "" Then Exit Sub
Application.EnableEvents = False
Cells(Target.Row, 1).Value = Date
Application.EnableEvents = True
End Sub



"Steve" wrote in message
...
Can a Data Form field be automatically populated with current date? Tying to
avoid having users type in this field for every row entered.




Steve

Data Form
 
I appreciate the response very much Bernie. However this would appear to work
for a worksheet. I am attempting to get the date into a dataform that is to
be populated and can't enter a formula directly into the form. The worksheet
is only populated when Enter is pressed but the date would have already been
entered into the dataform.

"Bernie Deitrick" wrote:

Steve,

Copy the code below, right click the sheet tab, select "View Code" and paste the code into the
window that appears.

This code will put the date into column A of any row where data is entered IF that cell is currently
blank.

HTH,
Bernie
MS Excel MVP

Private Sub Worksheet_Change(ByVal Target As Range)
If Cells(Target.Row, 1).Value < "" Then Exit Sub
Application.EnableEvents = False
Cells(Target.Row, 1).Value = Date
Application.EnableEvents = True
End Sub



"Steve" wrote in message
...
Can a Data Form field be automatically populated with current date? Tying to
avoid having users type in this field for every row entered.






All times are GMT +1. The time now is 08:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com