sort without limiting range

  • Recorded a macro to sort a list, but it has this line in it - Range ("W2:W16")
    Next time list likely to have different number of rows

    What should the code be to not be limited to a set range?

  • You could replace 16 by your own variable

    Dim last As Long
    last = Worksheets("Sheet1").Cells(Rows.Count, 23).End(xlUp).Row

    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:)

Participate now!

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