# Sorting

#### Fire_Chief

##### Well-known Member
I have an array of numbers that I want to sort from highest to lowest.

Numbers(100)

### Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
That one I wanted to just know the highest number

Sub ShellSort()
Dim i As Long, j As Long, inc As Long, list As Variant
Dim var As Variant, LowIndex As Integer, HiIndex As Long
Dim myArray\$

'list = [{"Nate","Colo","Orange","Ivan"}]
list = [{2,1,4,3}]

LowIndex = LBound(list): HiIndex = UBound(list)
inc = 1

Do While inc <= HiIndex - LowIndex: inc = 3 * inc + 1: Loop
Do
inc = inc \ 3

For i = LowIndex + inc To HiIndex
var = list(i)
j = i

Do While list(j - inc) > var
list(j) = list(j - inc)
j = j - inc

If j <= inc Then Exit Do
Loop
list(j) = var
Next

Loop While inc > 1

For a = 1 To 3
myArray = myArray & list(a) & ", "
Next a

myArray = myArray & list(4)

MsgBox myArray
End Sub

That certainly works well but I have no idea how to apply that to my spreadsheet..

What I have is

NUMBERS(1) = 237
NUMBERS(2) = 468
NUMBERS(3) = 15
NUMBERS(4) = 729
NUMBERS(5) = 333
NUMBERS(6) = 934

Marty

Replies
13
Views
295
Replies
6
Views
496
Replies
6
Views
245
Replies
7
Views
280
Replies
3
Views
171

1,219,808
Messages
6,150,351
Members
450,952
Latest member
Zung

### 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.

### Which adblocker are you using?

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

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