T O P I C R E V I E W |
mrandersb |
Posted - 06/23/2010 : 11:22:23 AM Hey I have one book with one sheet in it. in that sheet there is an column with different ID numbers in them. I try to use the "set values" on another column, and would like to use the given ID to acces another sheet with that ID as a name.
My try was something like this:
range cc = [Book2]Sheet1!Col(D1);
string ttt$ = "cc";
range test = [ttt$]ttt$!; NumberOfRows = test.nRows/test.nCols;
double A = 0;
for(ii = 1; ii <= NumberOfRows; ii++) { A = A + ID23017_A[ii]; }
A = A/NumberOfRows;
If i change the line
string ttt$ = "cc";
with
string ttt$ = "ID23017";
it works (ID23017 is one of the correct IDs) |
2 L A T E S T R E P L I E S (Newest First) |
mrandersb |
Posted - 06/24/2010 : 02:36:36 AM I still get an expression error, with both methods. How do i check what is in the ttt string. I'm programming in the Set values - Before formula scripts window.
ps. Are there a better place to be programming these things? |
Laurie |
Posted - 06/23/2010 : 12:31:14 PM string ttt$ = "cc";
After running the above assignment statement, if you check the value of ttt$ you'd see it holds the string "cc".
If you wanted it to return "[Book2]Sheet1!Col(D1)" then you'd use the following:
string ttt$ = %(cc);
but I think when you say the column has an ID that you mean the ID is the Long Name?
so what you really want is the following:
range cc = [Book2]Sheet1!Col(D1); string ttt$ = cc[L]$;
Also when you use the ID23017_A notation, you could replace that with range notation too. Create a range variable that is the A column in the ID23017 sheet and then use that. For example:
range rr = [SomeBook]ID23017!col(A); A = A + rr[ii];
By the way, replace "A = A + rr[ii];" with "A+=rr[ii];". This shorthand notation will also result in a speedier calculation.
OriginLab Technical Support |