フィルターのクリア

Get single value of merged cell after active cell

2 ビュー (過去 30 日間)
Ghenji
Ghenji 2018 年 5 月 14 日
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 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

製品


リリース

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by