left command causing trouble

  • Hi All


    I have following problem.


    I wrote simple program which do one thing: it goes through number of cells in particular column and and cut first 10 chars from following 15/01/2006 13:28 so there is only date left without the time.


    Here is my script:



    My problem is that after this script went through all data it occurs that dates were changed in following manner:


    01/11/2006 was changed to 11/01/2006


    I checked data format and it is dd/mm/yyyy.


    I am very beginner and possibly i did something wrong, can you suggest me what else i should check?


    Panoramix

  • Re: left command causing trouble


    Not an answer per se, but why don't you just format the cells as date and not worry about the time? Is the data stored as a date/time or is it really text?

  • Re: left command causing trouble


    If your Cell contains say, 15/01/2006 13:30


    the VBA


    Code
    Datevalue(Activecell)


    will return


    15/01/2006


    There is no need for the cutting stuff :)

  • Re: left command causing trouble


    Quote from Panoramix

    I wrote simple program which do one thing: it goes through number of cells in particular column and and cut first 10 chars from following 15/01/2006 13:28 so there is only date left without the time.


    Okay, I am still learning VBA, but I also have a need to do things in a simple manner. For this type of task, as a member of the Idiot Club, I would (personally) perfer to use ASAP Utilities Add-in which is FREE. Based on your original post you need to cut 10 characters. ASAP Utilities allows you to select the cells and then select "Delete Number of Leading Characters" from the ASAP menu and then you enter 10 for the number you want, and instantly DONE!


    I have a need to not make things more difficult than they need to be. For me, ASAP Utilities is a must-have add-in that I would be lost without. And the fact that it is a free add-in is much appreciated by poor idiots, like myself. I do hope that this information is of use to someone else.

  • Re: left command causing trouble


    If you are still having problems I suspect your regional settings are set to 'English (United States)' which will return mm/dd/yy whereas 'English (United Kingdom)' will return dd/mm/yy


    R

Participate now!

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