help with short line of code, please

BAS872

New Member
Joined
Sep 17, 2002
Messages
5
The line of code that follows, which you helped me with, sorts data in A1:F15 when any one or more of the bottom rows contain no data:

Sub SortList()
Dim sList As Range
Set sList = Range(("A1"), Range("F65536").End(xlUp))
sList.Sort Key1:=Range("A1"), Order1:=xlDescending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

Question:
How can I modify it so that t sorts data in GO32:GT44, when any one or more of thebottom lines contain no data?

When I try the following adaptation, the value in GO32 moves yp to GO1 and no sorting gets done!!

Sub SortList()
Dim sList As Range
Set sList = Range(("GO32"), Range("F65536").End(xlUp))
sList.Sort Key1:=Range("GO32"), Order1:=xlDescending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom


End Sub

I would appreciate your help
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

rodrenfro

New Member
Joined
Jun 28, 2002
Messages
7
You just need to change your "set range" line.

Set sList = Range(("GO32"), Range("F65536").End(xlUp))

--- Change To ----
Set sList = Range(("GO32"), Range("GT65536").End(xlUp))


On 2002-09-28 23:37, BAS872 wrote:
The line of code that follows, which you helped me with, sorts data in A1:F15 when any one or more of the bottom rows contain no data:

Sub SortList()
Dim sList As Range
Set sList = Range(("A1"), Range("F65536").End(xlUp))
sList.Sort Key1:=Range("A1"), Order1:=xlDescending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

Question:
How can I modify it so that t sorts data in GO32:GT44, when any one or more of thebottom lines contain no data?

When I try the following adaptation, the value in GO32 moves yp to GO1 and no sorting gets done!!

Sub SortList()
Dim sList As Range
Set sList = Range(("GO32"), Range("F65536").End(xlUp))
sList.Sort Key1:=Range("GO32"), Order1:=xlDescending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom


End Sub

I would appreciate your help
 

Forum statistics

Threads
1,144,439
Messages
5,724,369
Members
422,547
Latest member
Vision1291

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top