Date Format in userform textbox where range is offset from lastrow

  • Hi everybody!


    finally completed my userform! I have got it to create a record on the next available row, search for a record and update it...


    it has severely affected my brain cells and I have just stumbled upon my (hopefully) final hurdle. I hope somebody can help with.


    The date format is MM/DD/YYYY and I need it to be DD/MM/YYYY. I have seen many posts saying to use an addin or something else that needs an activeX control but I can't use this. I have also seen bits of code to solve this but they all set a range. My range is an offset though from the last empty row. please see my code.


    This is what I have to Create a new record



    Update record


    sorry if this looks messy im writing this on my phone

  • Re: Date Format in userform textbox where range is offset from lastrow


    Maybe


  • Re: Date Format in userform textbox where range is offset from lastrow


    Hi Roy, this still inputs the date in US format. But now when I search for the record the dates come back as FALSE.

  • Re: Date Format in userform textbox where range is offset from lastrow


    Somehow if i have the format as DD/MMM/YYYY it works! Thanks Roy!

  • Re: Date Format in userform textbox where range is offset from lastrow


    Try this approach


    Code
    LastRow.Offset(1, 4).Value = TextBox2.Text 'this textbox inputs the date
    LastRow.Offset(1, 4).NumberFormat= "DD/MM/YYYY"
  • Re: Date Format in userform textbox where range is offset from lastrow


    Nearly there Roy!


    Can't get my head around searching for the date in UK Format.


    Using the methods you mentioned above, this just brings back a 'True' or 'False' result.


    Any Ideas?


    Code
    With Me    'load entry to form                .ComboBox1.Value = c.Offset(0, 1).Value
                    .ComboBox2.Value = c.Offset(0, 2).Value
                    .ComboBox3.Value = c.Offset(0, 3).Value
                    .ComboBox4.Value = c.Offset(0, 4).Value
                    .TextBox2.Value = c.Offset(0, 5).Value
                    .TextBox3.Value = c.Offset(0, 6).Value
                    .TextBox4.Value = c.Offset(0, 7).Value
  • Re: Date Format in userform textbox where range is offset from lastrow


    You don't search for a date in a particular format.


    Dates are stored as numbers by excel, so 09/03/13 is actually 41342. What you see is only Formatting.


    I've posted code for finding dates. let me see your spreadsheet & I'll have a better idea of what you are doing.

Participate now!

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