From: Doug Bell on
I need to get Matlab to issue commands to Excel that will copy a range of lines containing both formatted text and formatted numerical values to another region of the spreadsheet. So far I have :
excel = actxserver('excel.application');
wkbk = excel.Workbooks.Open(case_spreadsheet);
wksheet = wkbk.Worksheets.Item('Page1');
Range = excel.Range('A2:AK7'); % Need to copy to location 'A8'
From: Andy on
"Doug Bell" <dbell8(a)ford.com> wrote in message <i1kqic$rsp$1(a)fred.mathworks.com>...
> I need to get Matlab to issue commands to Excel that will copy a range of lines containing both formatted text and formatted numerical values to another region of the spreadsheet. So far I have :
> excel = actxserver('excel.application');
> wkbk = excel.Workbooks.Open(case_spreadsheet);
> wksheet = wkbk.Worksheets.Item('Page1');
> Range = excel.Range('A2:AK7'); % Need to copy to location 'A8'

I'm not at MATLAB right now, so I can't check. But this looks very suspect:

Range = excel.Range(...)

I don't think the application has a Range property or method. But something like the following should work:

% warning: untested code
wksheet.Range('A2:AK7').Copy;
wksheet.Paste(wksheet.Range('A8:AK13'));
From: Doug Bell on
"Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i1kru0$rdl$1(a)fred.mathworks.com>...
> "Doug Bell" <dbell8(a)ford.com> wrote in message <i1kqic$rsp$1(a)fred.mathworks.com>...
> > I need to get Matlab to issue commands to Excel that will copy a range of lines containing both formatted text and formatted numerical values to another region of the spreadsheet. So far I have :
> > excel = actxserver('excel.application');
> > wkbk = excel.Workbooks.Open(case_spreadsheet);
> > wksheet = wkbk.Worksheets.Item('Page1');
> > Range = excel.Range('A2:AK7'); % Need to copy to location 'A8'
>
> I'm not at MATLAB right now, so I can't check. But this looks very suspect:
>
> Range = excel.Range(...)
>
> I don't think the application has a Range property or method. But something like the following should work:
>
> % warning: untested code
> wksheet.Range('A2:AK7').Copy;
> wksheet.Paste(wksheet.Range('A8:AK13'));

That works, thanks!