• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Convert Date Format

delta

Member
in my userform textbox5 contain date and date format is "dd/mm/yyyy" when sheet data (Colmun B) transfer to textbox then date format change automaticly " mm/dd/yyyy" . how to correct change date format " (mm/dd/yyyy) to (dd/mm/yyyy)
 
Normal as by default a date is in format 'mm/dd/yyyy' - or 'yyyy/mm/dd' - on VBA side …​
So try CDate function or other date functions - to see in VBA help - or just reverse the day and the month …​
 
i try this code

Code:
Format(CDate(Me.TextBox5.Value), "dd/mm/yyyy"),(Me.TextBox5.Text) = Sheets("Sheet1").Cells(y, 2)
but it show error plse help with correct code
and also when textbox5 value (contain date) transfer to worksheet then i shown in left side instead of right side
Code:
Sheets("Sheet1").Cells(lastrow, 2).Value = Me.TextBox5.Text
 
Last edited by a moderator:
Left side means text and no date … You can extract the day and the month via Split or Mid function for example …​
Or if your Date OS setting is in dd/mm/yyyy format so you can use the FormulaLocal cell property to allocate directly the 'date' …​
 
Back
Top