Reversed date

Solved
abdellah_tadjine Posted messages 203 Status Member -  
ccm81 Posted messages 11033 Status Member -
Hello,
I created an application in userform to manage a small database, everything works very well except when I type the date in the textbox, I find it inverted in my Excel sheet
for example, I type 03/09/2017 in the textbox but it writes 09/03/2017 in the sheet, thank you for giving me an explanation to solve this problem.

Configuration: Windows / Chrome 59.0.3071.115

3 answers

  1. madmyke Posted messages 52304 Registration date   Status Moderator Last intervention   12 488
     
    Hello

    Excel displays dates based on the "regional settings"; you should first check these in the control panel.
    If they are correct, then it's because Excel does not recognize the date format from your file.
    Since this comes from a text format, that's probably the issue.
    Apart from forcing the Excel column to date format, I don't see any solution.
    This is quite a common problem when importing into Excel.

    Best regards

    --
    "We swallow the flattering lie in great gulps and sip the bitter truth drop by drop."
    0
    1. abdellah_tadjine Posted messages 203 Status Member 6
       
      thank you anyway,
      0
  2. Anonymous user
     
    Good evening,

    how do you pass the value of your textbox to the cell?

    --
    When I was little, the Dead Sea was only sick.
    George Burns
    0
  3. ccm81 Posted messages 11033 Status Member 2 434
     
    Hello

    Try this

    Private Sub CommandButton1_Click()
    Dim dt As String, d As Date
    dt = Me.TextBox1.Text
    d = CDate(dt)
    Range("A1").Value = d
    End Sub

    cdlmnt
    0