View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mark Rosenkrantz[_2_] Mark Rosenkrantz[_2_] is offline
external usenet poster
 
Posts: 33
Default Sort row values descending

Wendy;

You don't need a macro, but you can use the recorder to see what it spits
out when you do this :

Select a row, or the rows
Choose Sort.
In the dialogbox, choose options.
Choose : sort left to right.
Choose your order and there you go.

Mark.

More Excel ? www.rosenkrantz.nl or
--------------------------------------------------------------------


"Wendy" wrote in message
...
I need to sort values in a row in descending order.

Example:
1,5,6,7
2,6,3,5
3,2,8,1

Should sort:
7,6,5,1
6,5,3,2
8,3,2,1

I can't figure out the code to do this. Any help?
Here's what I have so far:

For Each rw In Worksheets("qrysctrucks").Rows
rw.Select
Selection.Sort Key1:=Rows(1), Order1:=xlDescending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlLeftToRight, _
DataOption1:=xlSortNormal
Next rw