Posts by ZoolPool

    Hi All


    I want to create a macro to stop me having to Data>Sort and select four columns in order every time. So it allows me to sort a highlighted range, by multiple columns. The two issues I have are:


    I cant control and down to the last row, because there will be blanks in the data.


    The range will change size and locations a lot, hence why I'm highlighting the data.


    Part of my code for example:

    Code
    ActiveWorkbook.Worksheets("Sheet2").Sort.SortFields.Add Key:=Range("F14:F21") _, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal


    May include Row 17 as a blank so I cant control down, and the next set of data to sort could be B3:B10. I can always highlight the range, but I cant get VBA to sort that highlighted range.


    All help welcomed!


    Thanks