R1C1 形式で Excel 内のセルにアクセスする方法はありますか?

15 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2013 年 10 月 25 日
編集済み: MathWorks Support Team 2015 年 10 月 2 日
Active X を利用して Excel にアクセスしています。セルの範囲を取得する際、下記のように A1 形式で与えることは可能ですが
 
e.Activesheet.get('Range', 'A1:B2');
下記のような R1C1 形式(行と列ともに数値)で与える方法を教えてください。
 
Range(.Cells(1, 1), .Cells(10, 10))

採用された回答

MathWorks Support Team
MathWorks Support Team 2015 年 10 月 2 日
各セルを Cells メソッドを使って事前に取得してご利用ください。
exl = actxserver('Excel.Application');
exlWkbk = exl.Workbooks;
exlFile = exlWkbk.Open('XXXXXXX'); % ファイルをオープン
Activesheet = exlFile.Activesheet;
fromCells = get(Activesheet, 'Cells', 1, 1); % 開始のセル
toCells = get(Activesheet, 'Cells', 2, 2); % 終了のセル
eActivesheetRange = get(Activesheet, 'Range', fromCells, toCells);
eActivesheetRange.Value

その他の回答 (0 件)

製品


リリース

R2010b

Community Treasure Hunt

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

Start Hunting!