Putting a date in a user form

Boardbud

New Member
Joined
Jun 21, 2011
Messages
4
I am trying to get a date to auto populate with the current date in my user form. I am struggling to get this correct any help would be appreciated.
Code:
Private Sub TransactionDate_Change()
Dim MyDate As String
MyDate = Format(Now, "mm/dd/yyyy")
MyDate = Now
End Sub
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Thhis will populate Textbox1 with the current date when you make a change to TransactionDate.

Code:
Private Sub TransactionDate_Change()
    TextBox1.Value = Format(Date, "mm/dd/yyyy")
End Sub
 
Upvote 0
Where do you want the date to appear on the userform?

You need to use something like this:
Code:
TextBox1.Value = Date
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,702
Members
452,938
Latest member
babeneker

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