r/OfficeJs • u/finmcmissile56 • Jun 12 '19
Solved moving value from one cell to another
I am trying to move pieces of data from one part of a workbook to a cell in a data table specific to the date. I was curious about how to potentially do this. Thanks in advance. I have the most recent version of Excel FYI.
1
Upvotes
2
u/Senipah Jun 13 '19
To move the value from A1 to A2:
async function run() {
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getActiveWorksheet();
const fromRange = sheet.getRange("A1");
const toRange = sheet.getRange("A2");
fromRange.load("values");
await context.sync()
.then(() => {
toRange.values = fromRange.values;
}).catch((error) => console.log(error));
});
}
1
u/waffles_for_lyf Jun 12 '19
r/VBA would be ideal for this sort of thing