Date formating when saving to excel sheet

  • i Am trying to save the date in this why DD/MM/YY not MM/DD/YY i have tryed Cdate but i cannot get it working when i have blank cells i only fill in textboxes that need filling and sometime i have to delete dates when the person no longer have the goods see code


  • Re: Date formating when saving to excel sheet


    Have you tried changing the format of the cell you are transferring the data to? As your UserForm has generic names for all it's parts, we have no idea which lines are talking about dates. :(

    Best Regards,
    Luke M
    =======
    "A little knowledge is a dangerous thing."

  • Re: Date formating when saving to excel sheet


    Yes I have tried that where it says me.textbox that's all my date boxes

  • Re: Date formating when saving to excel sheet


    you should use



    Code
    format(Me.TextBox1.Value,"DD/MM/YYYY")


    but remember while retriving dates you should make the format as mm/dd/yyyy or else it will make the DD as MM by default....

  • Re: Date formating when saving to excel sheet


    sorry i cant get it working its showing it right on the userform but not in excel sheet i have formatted the excel sheet to uk DD/MM/YY
    this is what i have done to the code it really doing my head in i did try and upload file but did not work

  • Re: Date formating when saving to excel sheet


    pejabe you are making the date formated into the code so no need of formating the excel range to Uk DD/MM/YY this is making the data again into MM/DD/YY...

  • Re: Date formating when saving to excel sheet


    the excel sheet is formatted to General the userform shows it correct but when viewing excel sheet it shows in US i not sure whats going on i have delete and started again still no look

  • Re: Date formating when saving to excel sheet


    Don't use Format if you want real dates, use CDate or DateValue but check there's a date in the textbox before you do anything.

    Code
    If Me.TextBox8.Value <> "" And IsDate(Me.TextBox8.Value Then
        ws.Cells(iRow, 4).Value = Format(Me.TextBox8.Value, "DD/MM/YY") 
    End If


    PS You should consider using a listbox.

    Boo!:yikes:

  • Re: Date formating when saving to excel sheet


    i would like to thank everyone that helped i have found the solution all i needed to do was change "DD/MM/YY") to "DD/MMM/YYYY") and it works perfect

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!