sort problem

  • Thread starter Thread starter John
  • Start date Start date
J

John

I am trying to sort by column "s" and the following code does nothing... but
doesn't have any VBA errors. I am in excel 2007

Range("A4:x4").Select
'Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWorkbook.Worksheets("CALLMON").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("CALLMON").Sort.SortFields.Add Key:=Range( _
"S4"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal


any ideas?????????
 
see if this will work for you, i don't know which version of excel you're using.

Sub test()
With Worksheets("callmon").Range(Range("A4:Z4"), Range("A4:x4").End(xlDown))
.Sort Key1:=.Range("S4"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
End Sub
 
Back
Top