vba sort by date

  • Hi Everyone,
    On my spreadsheet, E2:E1215 has dates , my vba (produced from recorded macro. its not providing the correct result.
    I have searched various posts to do it with vba and all are for very advanced applications of the sort.
    Can someone please assist with the basic vba for this

  • Re: vba sort by date


    I should have stated in the post that the aim is to do a sort by date ascending (oldest to newest) over cell range ("E2:E1215")

  • Re: vba sort by date


    Hello Pepe,


    When you say, it is not working correctly. What is the problem? is it throwing up any error messages? is it not sorting dates sequentially?


    The code below is a structure you can copy. It will sort on column E (dates).


    However, it assumes that there is data ajacent to the Dates column E. So the range I have set is for columns C:E (change this as you please). The other thing to check would be that the cells are all formatted as dates and not text.



    Let me know how you get on.


    Many Thanks
    Caleeco

Participate now!

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