Reading multiple cells after merged cell from excel sheet
Show older comments
Cells A1 and B1 are merged. Now when I read Cells A1 and B1 with Excel COM Application, they read 'Waste Accumulation'and 'NaN' and The immediate cell going down after merged cell is just A2 . Is there a method with which I can read both the cells A2 and B2 after read merged cell? I would like to read column after cells A2 and B2 separately.

3 Comments
Guillaume
on 14 Mar 2018
"when I read Cells" Using what method? xlsread? your own code via actxserver? Please show us exactly how you do it, so we know whether the problem is with your code or elsewhere.
I've just created a spreadsheet exactly as you've described and, using the COM interface I get:
>> %... acquire reference to worksheet: ws.
>> ws.Range('A1').MergeArea.Address
ans =
'$A$1:$B$1'
>> %the above proves that A1 and B1 are merged
>> rg = ws.Range('A1:B2');
>> rg.Value
ans =
2×2 cell array
{'Waste Accumulation'} {[NaN]}
{'Qua' } {'Rev'}
using R2017b and excel 2013 (32-bit).
Ghenji
on 14 Mar 2018
Accepted Answer
More Answers (0)
Categories
Find more on Use COM Objects in MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!