ні, там не потрібно другий цикл. Я в цьому не дуже шарю, але попробувала змінити трошки, але все одно в кінці не дуже пашить
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids;
type
  TForm1 = class(TForm)
    StringGrid1: TStringGrid;
    Label1: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    Label2: TLabel;
    StringGrid2: TStringGrid;
    procedure Edit1Change(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 matr=array[1..15,1..15]of real;
var
  Form1: TForm1;
  n:integer;
  a:matr;
  min:Real;
implementation
{$R *.dfm}
procedure m(var a:matr);
var
  n:integer;
 min:real;
m_i,m_j,i,j:integer;
begin
  min:=a[1,1];
   m_i:=1; m_j:=1;
for i:=1 to n do
for j:=1 to n do
if a[i,j]<min then
begin
min:=a[i,j];
m_i:=i;
     m_j:=j;
   end;
 if (min>=-6) and (min<=6) then a[m_i,m_j]:=0;
 end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
n:=StrToInt(Edit1.Text);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
n:=2;
StringGrid1.Visible:=False;
StringGrid2.Visible:=False;
end;
procedure TForm1.Button1Click(Sender: TObject);
var i,j:integer;
begin
   StringGrid1.ColCount:=n+1;
   StringGrid1.RowCount:=n+1;
   StringGrid1.Cells[0,0]:='A';
   for i:=1 to n do
   for j:=1 to n do
    begin
    StringGrid1.Cells[j,i]:='0';
    a[i,j]:=StrToFloat(StringGrid1.Cells[j,i]);
    end;
   for i:=1 to n do
   begin
    StringGrid1.Cells[0,i]:=FloatToStr(i);
    StringGrid1.Cells[i,0]:=FloatToStr(i);
    end;
    StringGrid1.Visible:=true;
end;
procedure TForm1.Button2Click(Sender: TObject);
var i,j:integer;
   min:real;
begin
  for i:=1 to n do
  for j:=1 to n do
   a[i,j]:=StrToFloat(StringGrid1.Cells[j,i]);
   StringGrid2.RowCount:=n+1;
   StringGrid2.ColCount:=n+1;
   StringGrid2.Cells[0,0]:='y';
   m(a);
   for i:=1 to n do
   for j:=1 to n do
   StringGrid2.Cells[i,j]:=FloatToStr(a[j,i]);
   StringGrid2.Visible:=true;
end;