Sorting Using Code

  • Thread starter Thread starter Jim May
  • Start date Start date
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,
 
Range("A5:L3776").Sort Key1:=Range("B5"), _
Order1:=xlAscending, Key2:=Range("G5"), _
Order2:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top