Sorting of Multiple Columns

  • I have a sheet with four columns that i want sorted from. I have recorded a macro to do it, which works fine for the 4 columns.


    How do I do that same thing for N columns


  • Try this


    I've looked at the rest of your code and it needs tidying up.


    1. Selecting is not necessary and will slow the code down.
    2. It's not clear what sheet the code should be working on. You should explicitly define the range including sheet name
    3. You haven't declared your variables.
    4. If the sheet exists that you are adding then the code will fail.