Sort Macro (2 levels)
The code below sorts column "A" but if I wanted to add a level to the sort
that would sort column "B". How would I do that? Range("data1").Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlNo Thanks Carlos |
Sort Macro (2 levels)
try something like this
With Range("data1") .Sort Key1:=.Range("A1"), Order1:=xlAscending, Key2:=.Range("B1") _ , Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _ False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 _ :=xlSortNormal End With -- Gary "cgsteel" wrote in message ... The code below sorts column "A" but if I wanted to add a level to the sort that would sort column "B". How would I do that? Range("data1").Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlNo Thanks Carlos |
Sort Macro (2 levels)
2 things:
watch the word-wrap and this will work in xl2003 and later. -- Gary "cgsteel" wrote in message ... The code below sorts column "A" but if I wanted to add a level to the sort that would sort column "B". How would I do that? Range("data1").Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlNo Thanks Carlos |
All times are GMT +1. The time now is 02:47 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com