Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
JonasKlim
Posted - 10/30/2017 : 06:38:50 AM How to write a loop to perform operations on all sheets in a workbook except sheet named "Sheet1"?
6 L A T E S T R E P L I E S (Newest First)
yuki_wu
Posted - 11/02/2017 : 01:55:16 AM Hi Jonas,
Range is a data type that allows you to access columns, worksheet, matrix or loose dataset. It is just like a general vector, so you can’t assign a string variable to a vector. While aa[1] is considered as an element of the vector, so it works.
Regards, Yuki OriginLab
JonasKlim
Posted - 11/01/2017 : 10:21:37 AM Hi Yuki,
Thank you, this way it worked. Why it did not work when I have defined range range " aa= Sheet1!Col(C)[1]; ", pointing to specific cell? Regards,
Jonas
quote:Originally posted by yuki_wu
Hi Jonas,
string str$ = wks.Name$;
range aa = col(A);
aa[1]$ = str$;
Posted - 10/31/2017 : 08:26:30 AM Hi, I want to write name of the sheet to a cell. What shall be corrected in the script below? //; string str$= wks.Name$; str$=; range aa= Sheet1!Col(C)[1]; aa=str$; //; ("str$=" prints sheet name, but sheet name is not written in Col(C)[1].) Please advise.
Jonas
JonasKlim
Posted - 10/30/2017 : 08:49:54 AM Hi Yuki,
int rot=0; doc -e LW //Loop over all worksheet in the current workbook only; { string str$= wks.Name$; rot=rot+1; if (str$ != "Sheet1") {rot= ; str$=;}
}; has worked. Thanks. Jonas
quote:Originally posted by yuki_wu
Hi,
I think you may want something like this.
doc -e LW //Loop over all worksheet in the current workbook only
{
string str wks.Name$;
if(str != “Sheet1”)
{
…
}
}
Hope it helps.
Regards, Yuki OriginLab
yuki_wu
Posted - 10/30/2017 : 06:58:23 AM Hi,
I think you may want something like this.
doc -e LW //Loop over all worksheet in the current workbook only
{
string str wks.Name$;
if(str != “Sheet1”)
{
…
}
}