Hi,
You can new a book to output the sum result:
for example:
//New a workbook, and use "SumBook" as Long Name and short name
newbook name:="SumBook" option:=lsname;
//set Column1 longname in the new book
wks.col1.lname$= SumBook1;
for (ii=1; ii<=10; ii++)
{
range aa=[book1]sheet1!col($(ii));
sum(aa);
double bb=sum.total;
[SumBook]sheet1!Cell($(ii),1)=bb; //put the result to the newsheet Column 1
}
If the multiple books with the similar name, for example: Book1, Book2, Book3... and the number columns in a sheet are the same.
You can try to set the nested loop script:
I assume the columns your need to be calculate are in "Sheet1", and there is 3 books, and each book with 10 columns.
newbook name:="SumBook" option:=lsname;
wks.ncols=3; // set the column number in the new book
for (jj=1; jj<=3; jj++)
{
wks.col$(jj).lname$= SumBook$(jj);
for (ii=1; ii<=10; ii++)
{
window -a SumBook;
range aa=[book$(jj)]sheet1!col($(ii));
sum(aa);
double bb=sum.total;
[SumBook]sheet1!Cell($(ii),$(jj))=bb; //put the result to the newsheet Column 1
}
}
But if the name and the structure are different of the workbooks, I think that is not fit for this nested loop.
And you can study the Labtalk script in our online help page:
http://www.originlab.com/doc/LabTalk
Thanks
Jacqueline
OriginLab