date format in user form and excel show different format.

ellyna

Banned - Rules violations
Joined
Nov 29, 2020
Messages
89
Office Version
  1. 2013
Platform
  1. Windows
Does anyone could help me ? The date format appear differently. Does my vba code script wrongly?

1607579333042.png
1607579381612.png

[vba code]
Private Sub UserForm_Initialize()
txtDate.Text = Format(Date, "dd/mm/yyyy")
Call Reset
End Sub
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Can you post the code that's putting the value from the textbox in the cell?
 
Upvote 0
Can you post the code that's putting the value from the textbox in the cell?
This is the code. As the time is automatically when we open the user form.

[vba code]
Private Sub UserForm_Initialize()
txtDate.Text = Format(Date, "dd/mm/yyyy")
Call Reset
End Sub
 
Upvote 0
That's the code to put the current date in the textbox and as far as I can see its formatted as you specified in the Format function.
 
Upvote 0

Forum statistics

Threads
1,215,007
Messages
6,122,670
Members
449,091
Latest member
peppernaut

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