Good Afternoon,
I am in need of some help. I have a tab on a worksheet and I would like sort the first 9 columns of information. The sort order is going to by columns I then B then C.
The macro recorder gave me this
Columns("A:I").Select
Selection.Sort Key1:=Range("I2"), Order1:=xlAscending, Key2:=Range("B2") _
, Order2:=xlAscending, Key3:=Range("C2"), Order3:=xlAscending, Header:= _
xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
xlSortNormal
but I don't want to SELECT anything so I tried rewriting it to this
wsList.Columns("A:I").Sort Key1:=Range("I2"), Order1:=xlAscending, Key2:=Range("B2") _
, Order2:=xlAscending, Key3:=Range("C2"), Order3:=xlAscending, Header:= _
xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
xlSortNormal
where wsList is
Set wsList = Workbooks("SEOG Data.xls").Sheets("List")
and I end up with an error indicating the sort reference is not valid.
I am almost positive I have done this before, but I have been unable to locate an example in any of my previously written code. Or I might just have imagined that I have done this before without SELECTING anything.
Any suggestion?
Bookmarks