Author |
Topic |
|
Xeal
10 Posts |
Posted - 09/29/2011 : 05:29:02 AM
|
Hello,
I'd like to build a worksheet, in which I define values for different cells, e.g. A1 = 5.
How can I use this value in a different worksheet to calculate other cell values with the "set values" dialog ?
Regards Holger
|
|
vincenth
30 Posts |
Posted - 09/29/2011 : 11:37:14 AM
|
You can address a particular cell directly, while in the same sheet, as in:
col(a)[1]
or assign a range variable to it, which is better if you're going between sheets:
range aa = [Book1]Sheet1!col(a)[1]; range bb = [Book2]Sheet1!col(b)[7]; bb = aa;
If using Set Column Values, define the ranges in the Before Formula Scripts section.
Regards, Vince |
|
|
Xeal
10 Posts |
Posted - 09/30/2011 : 04:49:14 AM
|
Thanks for your quick answer. I tried your suggestion like this: I have a worksheet with the parameters I need for my calculations (three numbers). Each parameter is in the first line of this worksheet.
In the worksheet with my calculations, I defined three range variables (like: range r2 = [Book1]Sheet1!C"magnification"[1];) and use them in the set values column.
The Problem is: Origin does the calculation only in the first row of the column with my calculations.
If I define the range variable like this: range r2 = [Book1]Sheet1!C"magnification";
and write down the parameter in all the rows it works. But I'd like to write down the parameters only in the first row (one time) and then calculate with this parameter in all other rows from an other worksheet.
Regards Holger |
|
|
Hideo Fujii
USA
1582 Posts |
Posted - 09/30/2011 : 3:03:27 PM
|
Hi Holger,
There seems two issues:
1) In range r2=[Book1]Sheet1!C"magnification"[1] , it seems you specified both the short name and the long name of the column. This is not "incorrect", but redundant and error prone. So, if you have the short name, r2=[Book1]Sheet1!col(C)[1] is sufficient.
2) If you wan to control the referred cell by a row number, you can define a range of the column, then you can refer a cell by indexing the range variable such that: r2=[Book1]Sheet1!col(C);
ii=2; //row number of the parameter
myParameter = r2[ii]; Do these above suggestions make sense and work?
--Hideo Fujii OriginLab
|
Edited by - Hideo Fujii on 09/30/2011 3:04:32 PM |
|
|
Xeal
10 Posts |
Posted - 10/02/2011 : 06:36:38 AM
|
quote: Originally posted by Hideo Fujii
Hi Holger,
There seems two issues:
1) In range r2=[Book1]Sheet1!C"magnification"[1] , it seems you specified both the short name and the long name of the column. This is not "incorrect", but redundant and error prone. So, if you have the short name, r2=[Book1]Sheet1!col(C)[1] is sufficient.
2) If you wan to control the referred cell by a row number, you can define a range of the column, then you can refer a cell by indexing the range variable such that: r2=[Book1]Sheet1!col(C);
ii=2; //row number of the parameter
myParameter = r2[ii]; Do these above suggestions make sense and work?
--Hideo Fujii OriginLab
Hi,
Thanks for your answer. I don't understand why it works, but it works :)
Regards Holger
|
Edited by - Xeal on 10/02/2011 09:50:37 AM |
|
|
Xeal
10 Posts |
Posted - 10/04/2011 : 11:15:35 AM
|
Ok, next Problem: Everything works fine, but if I change the Parameters in my worksheet, the values I comupte don't update automatically. I assume, that the range variables have to be updated, after I changed the values of my parameters. How can I realize that ?
Regards Holger
|
|
|
Xeal
10 Posts |
Posted - 10/05/2011 : 12:13:53 PM
|
quote: Originally posted by Xeal
Ok, next Problem: Everything works fine, but if I change the Parameters in my worksheet, the values I comupte don't update automatically. I assume, that the range variables have to be updated, after I changed the values of my parameters. How can I realize that ?
Regards Holger
no ideas? |
|
|
Hideo Fujii
USA
1582 Posts |
Posted - 10/06/2011 : 09:48:53 AM
|
Hi Holger
> no ideas?
As in any computer language, in general once you assign some value to a variable, the variable's content wouldn't be updated until the assignment is executed next time. But, if your assignment of the variable in the "Before Formula Script" box in Set Values dialog, and Recalculation mode was set to "Auto", every time when the recalculation is kicked in, the assignment command will be also executed before the execution of the main body.
--Hideo Fujii OriginLab |
Edited by - Hideo Fujii on 10/06/2011 3:56:00 PM |
|
|
CaitPes81
USA
1 Posts |
Posted - 10/12/2011 : 12:29:20 AM
|
Have the same problem. This thread definitely helped me.
Caitlin Pescott |
|
|
|
Topic |
|
|
|