View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Eric Eric is offline
external usenet poster
 
Posts: 1,670
Default Sorting Backwards

If I sort from Column H to column A by putting a negative infront of the
letter it isn't working.

Dim sheet1 As Worksheet
Dim myrange As Range
Dim lrow As Long
Set sheet1 = ActiveSheet
Set myrange = sheet1.Range("h11")
lrow = sheet1.Cells(sheet1.Rows.count, myrange.Column).End(xlUp).Row

Set myrange = myrange.Resize(lrow - myrange.Row + 1, -6)<~~~~This is where I
am talking about. If I go from A to H everything is fine.

myrange.sort key1:=Range("h12"), Order1:=xlAscending, _
Key2:=Range("g12"), Order2:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
SortMethod:=xlSortNormal

Also, how do I get this to sort by Placing a specific contract number on top.

ie:
123
354
456

Now I want it to look like this
456
123
354