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

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
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
 
Upvote 0

Forum statistics

Threads
1,214,998
Messages
6,122,643
Members
449,093
Latest member
Ahmad123098

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
Back
Top