View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
pikus pikus is offline
external usenet poster
 
Posts: 1
Default Newbie : Help with sort via Excel code

Try this whe
n = First Row to be sorted
a = Last Row to be sorted
c = the number of the column to sort by (ie. Column "C" = 3, Column "E"
= 5 etc.)

For x = n To a
aNam = bp.Cells(x, 3).Value
z = x
For y = x + 1 To a
If bp.Cells(y, 3).Value < aNam Then
aNam = bp.Cells(y, 3).Value
z = y
End If
Next y

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


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