dss28
Board Regular
- Joined
- Sep 3, 2020
- Messages
- 165
- Office Version
- 2007
- Platform
- Windows
i have been finding it difficult to manage the date format in program developed by me and being used by many users in my department.
in my program i have asked to enter the date as 14/06/2021.
sometimes the entered date is seen as 14/06/2021 or 06/14/2021 or 14-06-2021 or 06-14-2021
Like for formating numbers in decimals i had used code eg. Format(Userform1.TextBox3, "0.000") to save the number in 3 digits.
Likewise is the following code correct to save a data in the desired format?
Code1:
I am transferring the data to a sheet in cell H15 through userform 2
Sheet1.Range("H15").Value = Format(UserForm2.TextBox3, "dd/mm/yyyy")
Code2:
or should I use the code in Userform _Initialise to assign a format for the cell H15 in the sheet1
eg.
Private Sub UserForm_Initialize()
With Sheet1
Range("H15").NumberFormat = "mm/dd/yyyy"
End With
End Sub
will this work or is there any other better solution.
in my program i have asked to enter the date as 14/06/2021.
sometimes the entered date is seen as 14/06/2021 or 06/14/2021 or 14-06-2021 or 06-14-2021
Like for formating numbers in decimals i had used code eg. Format(Userform1.TextBox3, "0.000") to save the number in 3 digits.
Likewise is the following code correct to save a data in the desired format?
Code1:
I am transferring the data to a sheet in cell H15 through userform 2
Sheet1.Range("H15").Value = Format(UserForm2.TextBox3, "dd/mm/yyyy")
Code2:
or should I use the code in Userform _Initialise to assign a format for the cell H15 in the sheet1
eg.
Private Sub UserForm_Initialize()
With Sheet1
Range("H15").NumberFormat = "mm/dd/yyyy"
End With
End Sub
will this work or is there any other better solution.