I am trying to perform a cell merge on an Excel file from Matlab. I don't know anything about this, but tried to use some code I found elsewhere online and adapted it a bit:
Excel = actxserver('Excel.Application');
Workbooks = Excel.Workbooks;
Excel.Visible = 0;
Workbook = Excel.Workbooks.Open('C:\Users\path&filename*.xlsx');
for k=1:length(B)-1
rng = [ExcelCol((k-1)*MaxH+2),num2str(1),':',ExcelCol(k*MaxH+2),num2str(1)];
procrng = [rng{:}];
Range = Excel.Range(procrng);
Range.Select;
Range.MergeCells = True;
Range.HorizontalAlignment = xlCenter;
end
ExcelCol is a user-defined function I found online that converts column number to Excel alphabet notation. It works - no doubt about it.
But when I run & step through the code, I get an error at Range.MergeCells = True. I get: "Undefined function or variable True'.
Can you please help?
Aucun commentaire:
Enregistrer un commentaire