Date Stamp

tiomin

Board Regular
Joined
Nov 27, 2003
Messages
147
Have a Date Field that I want to put current date in if I click the field. Can this be done through a macro? Default now(), and Date() won't do as I don't want the field to auto-populate when opened. It is a data completion form so it will only be completed when clicked and then stay static until clicked again.

Thanks
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Yes it is possible, very easy. But what if someone accidentally clicks the box? Then it cahnges your field value. Maybe a checkbox that says complete would work better, or a button that when pressed, it would populate the field. Anyways, here it is:
Code:
Private Sub myField_Click()
    Me.myField.Value = Date ' or use Now()
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,531
Messages
6,179,379
Members
452,907
Latest member
Roland Deschain

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