ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selection.Sort not working? (https://www.excelbanter.com/excel-programming/297327-selection-sort-not-working.html)

Avery[_2_]

Selection.Sort not working?
 
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

Bob Phillips[_6_]

Selection.Sort not working?
 
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)

"Avery" wrote in message
...
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




No Name

Selection.Sort not working?
 
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)

"Avery" wrote in message
...
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



.



All times are GMT +1. The time now is 08:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com