Forum Discussion
Re: ACTION SCRIPT RECORDER - MOVE COLUMN
Hi Jula78,
for moving the entire column C to column A using Excel Script you can try to use the following code:
function main(workbook: ExcelScript.Workbook) {
let selectedSheet = workbook.getActiveWorksheet();
// Cut column C on selectedSheet.
selectedSheet.getRange("C:C").cut();
// Insert cut cells from clipboard to A:A on selectedSheet.
selectedSheet.getRange("A:A").insert(ExcelScript.InsertShiftDirection.right);
}
This code will cut column C to the clipboard, and then insert the cut cells to column A. This will move column C to column A without inserting a blank column in between.
To run this code, you can copy and paste it into a new ExcelScript module, and then run the module by pressing F5.
Here are the steps on how to run the ExcelScript code:
- Open the Excel file where you want to move column C to column A.
- Press Alt+F11 to open the Visual Basic Editor.
- In the Insert menu, click Module.
- Paste the ExcelScript code into the module.
- Press F5 to run the code.
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
(LinkedIn)
1 Reply
- SergeiBaklanDiamond Contributor
cut method doesn't exists ExcelScript,Range interface
why TypeScript is inserted into VBA interface?
It looks like AI generated answer, did you test it?