Help with copy between workbooks (incorrect reference?)

Hey,

As part of a larger script I’m setting the value of two cells in a sheet i of a workbook “reducedDataName” and then taking the calculations resulting from that and putting them into another sheet in a workbook “combinedDataName”. Everything works great until it comes time to copy the cells into “combinedDataName”. It finds the right cells and columns, copies the correct data…and then pastes them into the active sheet of “reducedDataName” rather than into the sheet of “combinedDataName”.

Here is the code snippet


set value of cell "R5" of sheet i to natalStart
					set value of cell "S5" of sheet i to natalEnd
					tell range "R7:U7" of sheet i of reducedDataName
						set value of (get resize (row otoRow of column natalData of sheet otoData of combinedDataName) row size (count rows) column size (count columns)) to get its value
					end tell

Here is the Event Log output for that section of code when I run it

get value of range "R7:U7" of sheet 14 of workbook "Reduced data (test).xlsx"
	{{0.890309580752, 0.166119278667, 0.011748607105, 0.01535434176}}
count every row of range "R7:U7" of sheet 14 of workbook "Reduced data (test).xlsx"
	1
count every column of range "R7:U7" of sheet 14 of workbook "Reduced data (test).xlsx"
	4
get worksheet "Otolith Data" of workbook "Combined Datasheet (test).xlsx"
	worksheet "Otolith Data" of workbook "Combined Datasheet (test).xlsx"
get worksheet "Otolith Data" of workbook "Combined Datasheet (test).xlsx"
	worksheet "Otolith Data" of workbook "Combined Datasheet (test).xlsx"
get resize row 28 of column 15 of sheet (worksheet "Otolith Data" of workbook "Combined Datasheet (test).xlsx") of workbook "Combined Datasheet (test).xlsx" row size 1 column size 4
	range "'[Reduced data (test).xlsx]4102'!$O$28:$R$28"
set value of range "'[Reduced data (test).xlsx]4102'!$O$28:$R$28" to {{0.890309580752, 0.166119278667, 0.011748607105, 0.01535434176}}

It looks like I’m not referencing the range correctly and it is automatically using the range for the active sheet. I’m not sure why I’m not getting this, it seems like it should be pretty straightforward.

As I said in the other thread, fully qualifying your ranges should fix it.

set value of cell "R5" of sheet i of workbook "Reduced data (test).xlsx" to natalStart