Forum Discussion
ArchieSmith
Dec 22, 2022Copper Contributor
Office Script Indirect referencing
Hi everyone, I am trying to copy values from one cell to another using Office Scripts (which uses TypeScript), however these cells may change in row number and are therefore not fixed. Does...
rzaneti
Jan 20, 2023Iron Contributor
Hi Archie,
If I understood properly, you can achieve this result with two lines of code:
let value_to_paste = ws.getRange(String(box_hval)).getValue() //assign the value from cell H42, referenced in A1 to variable value_to_paste
ws.getRange(String(box_mval)).setValue(value_to_paste) //paste the value from value_to_paste in cell M42, referenced in A2
You just replace the "ws.getRange(box_mval).copyFrom..." line for it.
Let me know if I can help you with something else 🙂
If I understood properly, you can achieve this result with two lines of code:
let value_to_paste = ws.getRange(String(box_hval)).getValue() //assign the value from cell H42, referenced in A1 to variable value_to_paste
ws.getRange(String(box_mval)).setValue(value_to_paste) //paste the value from value_to_paste in cell M42, referenced in A2
You just replace the "ws.getRange(box_mval).copyFrom..." line for it.
Let me know if I can help you with something else 🙂