ironsides
Well-known Member
- Joined
- Aug 12, 2002
- Messages
- 575
A sheet contains sorts C19:C999 and K19:K9999 and they work fine
On the same sheet I want to sort cells K2:K14
the code I use is:
-------------------------------------------------
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range( _
"K2:K14"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("C2:K14")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("F5").Select
ActiveWorkbook.Worksheets("Sheet1").Range("K2").Select
End Sub
---------------------------------
But this doesn't work
How is this sort done?
On the same sheet I want to sort cells K2:K14
the code I use is:
-------------------------------------------------
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range( _
"K2:K14"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("C2:K14")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("F5").Select
ActiveWorkbook.Worksheets("Sheet1").Range("K2").Select
End Sub
---------------------------------
But this doesn't work
How is this sort done?