sort data

montecarlo2012

Well-known Member
Joined
Jan 26, 2011
Messages
984
Office Version
  1. 2010
Platform
  1. Windows
Book1
BCDEF
2103953
31110864
41211975
513121086
614131197
7151412108
8161513119
91716141210
101817151311
111918161412
122019171513
132120181614
142221191715
152322201816
162423211917
172524222018
182625232119
192726242220
202827252321
212928262422
223029272523
233130282624
243231292725
253332302826
263433312927
273534323028
283635333129
293736343230
303837353331
Sheet1

Hello, if you please help me to correct the following code
VBA Code:
Sub leftorighascending()
Dim ws As Worksheet
Dim Rng As Range
Dim r As Long
For r = 2 To Cells(Rows.Count, 6).End(xlUp).Row
Set Rng = Range("B" & r & ":F" & r)
Rng.Sort Key1:=Rng, Order1:=xlAscending
Next r
End Sub
this code it is not working
trying to get ascending order from left to right my dynamic array
is B2:F8686
thanks
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
order from left to right
You haven't specified the orientation in the code
Rich (BB code):
Sub leftorighascending()
    Dim ws As Worksheet
    Dim Rng As Range
    Dim r As Long
    For r = 2 To Cells(Rows.Count, 6).End(xlUp).Row
        Set Rng = Range("B" & r & ":F" & r)
        Rng.Sort Key1:=Rng, Order1:=xlAscending, Orientation:=xlLeftToRight
    Next r
End Sub
 
Upvote 1
Solution

Forum statistics

Threads
1,215,097
Messages
6,123,077
Members
449,094
Latest member
mystic19

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