How can you reorder Worksheets in a Workbook?

2 posts, 0 answers
  1. Nicholas
    Nicholas avatar
    12 posts
    Member since:
    Nov 2017

    Posted 15 May 2019 Link to this post

    I have a number of worksheets in a workbook, but I want to reorder them in a certain way. Is there a way to do this?

  2. Tanya
    Tanya avatar
    884 posts

    Posted 17 May 2019 Link to this post

    Hi Nicholas,

    You can use the Move() method of the Sheets collection of Workbook to reorder the worksheets to the desired positions:
    Workbook workbook = new Workbook();
    workbook.Worksheets.Add(); // Sheet1
    Worksheet secondWorksheet = workbook.Worksheets.Add(); // Sheet2
    workbook.Worksheets.Add(); // Sheet3
    workbook.Worksheets.Add(); // Sheet4
    workbook.Sheets.Move(3, 1, 0); // Move the fourth sheet to the first place

    I noticed that this information is missing in our documentation and will make sure it is updated as soon as possible.

    Hope this is helpful.

    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top