Reputation: 7591
How to change index of columns in MS excel using interop?
Say I want to move column C to column A position
I wonder how to do this programatically using excel interop
Upvotes: 3
Views: 3614
Reputation: 1185
Try This..
// cut column c and insert into A, shifting columns right
Excel.Range copyRange = xlWs.Range["C:C"];
Excel.Range insertRange = xlWs.Range["A:A"];
insertRange.Insert(Excel.XlInsertShiftDirection.xlShiftToRight, copyRange.Cut());
Upvotes: 3