Your code is working fine...Can you elaborate what do you want to do,
exactly?

On Jun 16, 3:11 pm, airen <airen1...@gmail.com> wrote:
> Sub bubblesort()
>     Dim i As Integer, j As Integer, n As Integer, temp As Single
>     n = Selection.Rows.Count
>     For j = n To 3 Step -1
>     For i = 1 To j - 1
>         If Selection.Cells(i, 1) < Selection.Cells(i + 1, 1) Then
>             temp = Selection.Cells(i, 1)
>             Selection.Cells(i, 1) = Selection.Cells(i + 1, 1)
>             Selection.Cells(i + 1, 1) = temp
>         End If
>     Next i
>     Next j
> End Sub
>
> Hello people,
> Above is a simple sorting algorithm. Now, in this algorithm, i want to
> swap records corresponding to cells (i) and cells(i+1).Please Help.

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

Reply via email to