EXCEL USERFORM DATE FORMAT PROBLEM

Vikramsing Kachhava 1 Reputation point
2022-09-09T13:25:42.687+00:00

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.

Excel Management
Excel Management
Excel: A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.Management: The act or process of organizing, handling, directing or controlling something.
1,708 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Daniel Colardelle 1 Reputation point
    2022-09-13T13:26:07.413+00:00

    Try :

    Dim Dat
    Dat = Split(Me.TextBox1.Value, "/")
    Range("A1") = DateSerial(Dat(2), Dat(1), Dat(0))

    Daniel

    0 comments No comments

  2. Aurélien ATIBARD 1 Reputation point
    2022-09-15T12:17:08.35+00:00

    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

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.