montecarlo2012
Well-known Member
- Joined
- Jan 26, 2011
- Messages
- 984
- Office Version
- 2010
- Platform
- Windows
Book1 | |||||||
---|---|---|---|---|---|---|---|
B | C | D | E | F | |||
2 | 10 | 3 | 9 | 5 | 3 | ||
3 | 11 | 10 | 8 | 6 | 4 | ||
4 | 12 | 11 | 9 | 7 | 5 | ||
5 | 13 | 12 | 10 | 8 | 6 | ||
6 | 14 | 13 | 11 | 9 | 7 | ||
7 | 15 | 14 | 12 | 10 | 8 | ||
8 | 16 | 15 | 13 | 11 | 9 | ||
9 | 17 | 16 | 14 | 12 | 10 | ||
10 | 18 | 17 | 15 | 13 | 11 | ||
11 | 19 | 18 | 16 | 14 | 12 | ||
12 | 20 | 19 | 17 | 15 | 13 | ||
13 | 21 | 20 | 18 | 16 | 14 | ||
14 | 22 | 21 | 19 | 17 | 15 | ||
15 | 23 | 22 | 20 | 18 | 16 | ||
16 | 24 | 23 | 21 | 19 | 17 | ||
17 | 25 | 24 | 22 | 20 | 18 | ||
18 | 26 | 25 | 23 | 21 | 19 | ||
19 | 27 | 26 | 24 | 22 | 20 | ||
20 | 28 | 27 | 25 | 23 | 21 | ||
21 | 29 | 28 | 26 | 24 | 22 | ||
22 | 30 | 29 | 27 | 25 | 23 | ||
23 | 31 | 30 | 28 | 26 | 24 | ||
24 | 32 | 31 | 29 | 27 | 25 | ||
25 | 33 | 32 | 30 | 28 | 26 | ||
26 | 34 | 33 | 31 | 29 | 27 | ||
27 | 35 | 34 | 32 | 30 | 28 | ||
28 | 36 | 35 | 33 | 31 | 29 | ||
29 | 37 | 36 | 34 | 32 | 30 | ||
30 | 38 | 37 | 35 | 33 | 31 | ||
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
trying to get ascending order from left to right my dynamic array
is B2:F8686
thanks