Cell51 is TMSFNCSpreadGrid, and this program will fail when k is greater than 1. Why?

procedure TForm1.TMSFNCToolBarButton1Click(Sender: TObject);
var
h,i,k,ni,crr : integer;
begin
Cell51.RowCount:=50;
Cell51.ColumnCount:=20;
i:=10;
ni:=20;
k:=2;
for h:=1 to k do
begin
cell51.BeginUpdate;
cell51.InsertRows(i+1,ni+2);
crr:=i;
cell51.Cells[1,crr]:='IS ok?';
cell51.MergeCells(2,crr,3,1);
cell51.EndUpdate;
end;
end;

You are trying to merge cells whilst also filling content and increasing the row count. Please first increase the rowcount and then merge the cells afterwards.