Code:

Procedure GridSort(StrGrid: TStringGrid; NoColumn: Integer);

Var Line, PosActual: Integer;

   Row: TStrings;

begin

Renglon := TStringList.Create;

For Line := 1 to StrGrid.RowCount-1 do

Begin

   PosActual := Line;

   Row.Assign(TStringlist(StrGrid.Rows[PosActual]));

   While True do

   Begin

     If (PosActual = 0) Or (StrToInt(Row.Strings[NoColumn-1]) >=

         StrToInt(StrGrid.Cells[NoColumn-1,PosActual-1])) then

       Break;

     StrGrid.Rows[PosActual] := StrGrid.Rows[PosActual-1];

     Dec(PosActual);

   End;

   If StrToInt(Row.Strings[NoColumn-1]) < StrToInt(StrGrid.Cells[NoColumn-1,PosActual]) then

     StrGrid.Rows[PosActual] := Row;

End;

Renglon.Free;

end;