title: Range.MergeCells in Matlab
body: <p>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:</p>
  
  <pre><code>Excel = actxserver('Excel.Application');
  Workbooks = Excel.Workbooks;
  Excel.Visible = 0;
  Workbook = Excel.Workbooks.Open('C:\Users\path&amp;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
  </code></pre>
  
  <p>ExcelCol is a user-defined function I found online that converts column number to Excel alphabet notation. It works - no doubt about it.</p>
  
  <p>But when I run &amp; step through the code, I get an error at Range.MergeCells = True. I get: "Undefined function or variable True'.</p>
  
  <p>Can you please help?</p>