sort problem

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?????????
 
G

Gary Keramidas

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
 

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

Similar Threads

Modify Sort Routine to inlcude All Data 2
Naming variable range selected by cursor movement 2
Undo Macro Action 3
Sorting Question 5
vba dynamic 1
Sort Dynamic Range 4
Sort halted 7
Clear Check Box 2

Top