Move Range of Cells in a Worksheet

Move Range of Cells in a Worksheet

The example code uses a template file to demonstrate the task.

The input file

todo:image_alt_text

Please see the following generated file with range A1:B5 moved to C1:D5.

The output file

todo:image_alt_text

// Instantiate the workbook object. Open the Excel file
Workbook workbook = new Workbook("book1.xlsx");
Cells cells = workbook.Worksheets[0].Cells;
Range range = cells.CreateRange("A1", "B5");
//move the range to right.
range.MoveTo(0, 2);
view raw Move-Range.cs hosted with ❤ by GitHub