View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Matt. Matt. is offline
external usenet poster
 
Posts: 43
Default Excel 2000 VBA Sort without Select

Thanks Pikus.

I understand the sorting algorithm. I just was hoping to use Excel's built
in method without using .SELECT or .ACTIVATE, because everything I've read
says the Selecting elements unnecessarily before working with them slows the
app down. But an algorithm like this will probably be just as slow as
selecting or activating the sheet I want to sort anyway. If my assumption
is wrong, please let me know.

cheers,
Matt.

"pikus " wrote in message
...
Dim ws As Worksheet
See if this helps. I'll be glad to explain how it works if you need me
to. - Pikus

Set ws = Worksheets(1)

For x = 2 To 50
alph = ws.Cells(x, 1).Value
a = x + 1
z = x
For y = a To 600
If ws.Cells(y, 1).Value < alph And ws.Cells(y, 1).Value < ""
Then
alph = ws.Cells(y, 1).Value
z = y
End If
Next y

If z < x Then
ws.Rows(z).Cut
ws.Rows(x).Insert
End If

Next x


---
Message posted from http://www.ExcelForum.com/