Author |
Topic |
|
maarnts
Netherlands
Posts |
Posted - 09/30/2013 : 06:21:08 AM
|
Origin 8.063.988 SR6 Operating System winXP:
I want to copy rows from one workbook_1 to another workbook_2 at a specific row number in workbook_2
I try to use the Xfunction wrcopy via labtalk. However when I include the dr1:= option I get an error message "Error: cannot find a (unique) variable corresponding to dr1"
When looking at the Xfunction code there seems no dr1 declared at all. When excluding the dr1 function works perfect, but the row is always pasted at the first row of workbook_2.
Could you please help me with this problem?
|
|
greg
USA
1378 Posts |
Posted - 09/30/2013 : 10:28:26 AM
|
Your version does not have the dr1 option. That was added after we realized the function had very limited use without it. (Not sure which version added the dr1.)
You can use the copydata function which just deals with continuous data ranges (and no labels) as in:
copydata irng:=[Book1]Sheet1!2:4[12] orng:=[Book2]Sheet1!6[3];
which copies the block of data from column 2, row 8 to column 4, row 12 in [Book1]Sheet1 to the block whose upper left is column 6, row 3 in [Book2]Sheet1. Note that the target column must exist, but additional columns need not exist yet when the function executes. |
|
|
maarnts
Netherlands
Posts |
Posted - 09/30/2013 : 11:01:11 AM
|
Unfortunately this workaround seems to work only for numeric data (I have also text and dates in my data sets.) |
|
|
greg
USA
1378 Posts |
Posted - 10/01/2013 : 5:04:59 PM
|
If your Dates (or Times) are formatted as Date (or Time) then they get treated as numerical values and are copied. If your Date values are NOT formatted as Date, then they will appear left-justified in a cell (like text). We of course recommend you do format any column with date values to be a Date format.
When copied, if the target column is not formatted as a Date then you will see Julian Day numbers, e.g. in the two million range.
A more general solution - one that works with Text as well - is a script that copies everything as text. Here is the script equivalent of the single copydata example I gave:
range rab1 = [Book1]Sheet1; range rab2 = [Book2]Sheet1; for(icol=2;icol<=4;icol++) { for(irow=8;irow<=12;irow++) { rab2!cell(3+irow-8,6+icol-2)$ = rab1!cell(irow,icol)$; } }
This assumes that all columns that will receive text are formatted as Text or Text&Numeric. A limitation here is that numeric values (or formatted Date values) copy only using display precision so you should set your source data to use maximum display precision. |
|
|
|
Topic |
|