Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro - Sort with expanded criteria not working. 1

Status
Not open for further replies.

Spidy6123

Technical User
May 30, 2002
227
CA
Hello Everyone,

Here's my macro:

Sub DoSort()
'
' DoSort Macro
' Macro recorded 10/21/2005 by 857441661
'
' Keyboard Shortcut: Ctrl+f
'
Sheets("Results").Select
Columns("G:G").Select
Selection.Sort Key1:=Range("G2"), Order1:=xlDescending, Key2:=Range("A2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
Selection.AutoFilter Field:=1, Criteria1:="<>FALSE", Operator:=xlAnd
End Sub


It's telling me the sort referance is not valid. Make sure that it's with the data that you want to sort, and the first Sort By box isn't the same or blank.

I just used the macro recorder, so I'm lost as to why it's not working correctly.

TIA

 
And what about this ?
Selection.Sort Key1:=Sheets("Results").Range("G2"), Order1:=xlDescending, Key2:=Sheets("Results").Range("A2") _

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
And this ?
With Sheets("Results")
.Range("G1").CurrentRegion.Select
Selection.Sort Key1:=.Range("G2"), Order1:=xlDescending, Key2:=.Range("A2") _

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top