How to use offset function of excel vba in Matlab coding environment????

2 visualizaciones (últimos 30 días)
thanks!!!
first_m = objSheet.Range('A:Z').Find('month').offset(0,1).Address;
my 'month' is in cell A1, my target cell is A2, my code is listed below.
objExcel = actxserver('excel.application');
set(objExcel, 'Visible',1);
sheetName = 'DPLLC';
objSheet = objExcel.Worksheets.get('Item', sheetName);
first_m = objSheet.Range('A:Z').Find('month').offset(2,1).Address;
but give me error like ??? 'Subscript indices must either be real positive integers or logicals.'
  2 comentarios
Fangjun Jiang
Fangjun Jiang el 2 de Ag. de 2011
Please include some of your code including the creation of the objSheet.
Nan Shen
Nan Shen el 2 de Ag. de 2011
Here you go! thank you!
my 'month' is in cell A1, my target cell is A2
objExcel = actxserver('excel.application');
set(objExcel, 'Visible',1);
sheetName = 'DPLLC';
objSheet = objExcel.Worksheets.get('Item', sheetName);
first_m = objSheet.Range('A:Z').Find('month').offset(2,1).Address;

Iniciar sesión para comentar.

Respuesta aceptada

Sean de Wolski
Sean de Wolski el 2 de Ag. de 2011
Matlab indexing starts at 1 not 0.
first_m = objSheet.Range('A:Z').Find('month').offset(1,1).Address;
  1 comentario
Nan Shen
Nan Shen el 2 de Ag. de 2011
my 'month' is in cell A1, I really want the address A2. as you remanding, I used first_m = objSheet.Range('A:Z').Find('month').offset(1,2).Address; but give me 'Index exceeds matrix dimensions.' how to deal with that?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by