Get single value of merged cell after active cell
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!