Get single value of merged cell after active cell
조회 수: 3 (최근 30일)
이전 댓글 표시

I have got this excel data and would like to access the value of merged cell. Some code I have worked with -
filename = '....\example.xls';
sheetname = 'Sheet15';
string = 'A15';
excel = actxserver('Excel.Application');
workbook = excel.Workbooks.Open(filename);
sheet = workbook.Worksheets.Item(sheetname);
find_string = sheet.Cells.Find(string,[],[],1)
string_row = find_string.Row; %ans here is 2
string_column = find_string.Column; %ans here is 8
required_stringrow = find_string.Row + 1; %ans here is 3
required_value = get(sheet, 'Cells', required_stringrow, string_column); %ans here is NaN
The value of the merged is present always in first cell(B3). So i can access it only from cell B2 with the above code. I get answer as NaN for cells C2,D2,E2,F2,G2,H2 for the above code. Instead I want answer as the value of merge cell. How do i do this??
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!