Selection.Sort not working?

A

Avery

I'm trying to execute a simple sort on a selection in
Excel. The help file, as well as most of the online
guides I've read have suggested using:

Selection.Sort

However, even if I simplify my request to the following
lines, I still get the "application or user defined error"

Worksheets(1).Range("A27:H38").Select
Selection.sort


Anybody know what's going on here?

Thanks


Avery
 
B

Bob Phillips

You have to specify a sort key at the minimum.

Worksheets(1).Range("A27:H38").sort Key1:=Range("A27")

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
G

Guest

Ah, brilliant. Thank you.


Avery


-----Original Message-----
You have to specify a sort key at the minimum.

Worksheets(1).Range("A27:H38").sort Key1:=Range("A27")

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)




.
 
Top