Thread: 1D Array Sort
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default 1D Array Sort

Let the worksheet sort help you:


1. copy the array into an unused column
2. sort the column
3. pull the values back int the array

Here is a very simple example:

Sub sortedaffair()
s = Array(3, 1, 6, 21, 8, 5, 19, 33)
For i = 0 To 7
J = i + 1
Cells(J, "B").Value = s(i)
Next

Columns("B:B").Sort Key1:=Range("B1")

For i = 0 To 7
J = i + 1
s(i) = Cells(J, "B").Value
Next
End Sub

--
Gary''s Student - gsnu200777


"Trent Argante" wrote:

I have a single dimension array that I would like sorted, and I am just
drawing a blank.
Thanks, folks.
--
Trent Argante
[DC.J(549)]