Sorting Using Code

J

Jim May

I have a data table A5:L3776 - Row 5 is header info
I need to enter code to sort this range
Primary Sort on B Column
Secondary Sort on G Column
The Macro recorder is screwing things up.
Can someone get me through this?
TIA,
 
T

Tom Ogilvy

Range("A5:L3776").Sort Key1:=Range("B5"), _
Order1:=xlAscending, Key2:=Range("G5"), _
Order2:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
 
Top