Sorting 10 rows without affecting other rows

  • Hi all, I have a question when using sorting function in VBA.

    I have a table which have around 30 rows.

    I would like to sort the date of 10 rows within the table (say row 11-20 only) and do not want to affect other rows.

    I created the following commend in VBA but fail to do so.




    I selected rows 11-20 but it sorted the whole table.

    How can I fix it?

    Thank you

    Kin

  • Hello and Welcome to the Forum :)


    In the macro you posted there is no indication of a specific range ...


    To create your macro, turn on the macro recorder ... and go through your process once ...


    you will get a " VBA translation " of your instructions ... a good starting point ... which you can, then, improve on ...


    Hope this will help

    :)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner:)

  • Maybe try the following.

    Note that this has been set up to sort the whole row of the table (using K as the last column in this example)