Try :
Dim Dat
Dat = Split(Me.TextBox1.Value, "/")
Range("A1") = DateSerial(Dat(2), Dat(1), Dat(0))
Daniel
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Im still new with the excel VBA. When I key in the date in the VBA form using this format (dd/mm/yyyy), it will interpret automatically as mm/dd/yyyy in the worksheet. My computer system settings for the date format is in dd/mm/yyyy and the excel date format is dd/mm/yyyy (I tried to put it as General and custom, both didnt work). Is there any solution for this? The VBA coding might help I guess.
Try :
Dim Dat
Dat = Split(Me.TextBox1.Value, "/")
Range("A1") = DateSerial(Dat(2), Dat(1), Dat(0))
Daniel
Hi,
You can force the date format as follow :
Format(Range(yourRange), "dd/mm/yyyy")
You can also check the "regional format" of your computer in your "Region" settings