How to sort a range that chages frequently.

dbmathis

Well-known Member
Joined
Sep 22, 2002
Messages
1,064
Hi all

What line of VBA would I use to sort a changing range?

Like for instance I use this code for rows A1:AK3000, but what if that range is a constantly changing range? Is there a way to make that code dynamic?

Code:
    With Sheets("Raw Data")
        .[A1:AK3000].Sort Key1:=Range("A2"), Order1:=xlAscending, Header:= _
        xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
    End With
 

Some videos you may like

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Watch MrExcel Video

Forum statistics

Threads
1,118,089
Messages
5,570,152
Members
412,306
Latest member
fabio6
Top