Click here to Skip to main content
15,897,519 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Now the issue is i want to reverse the order in which excel sheet are created and rearrange it.
How do i do it using C#.
Posted
Comments
CHill60 16-Jul-15 7:58am    
How are you creating the excel sheet? What do you mean by "rearrange"?
manish_coder 16-Jul-15 8:03am    
i am using Microsoft.Office.Interop.Excel for creating excel sheets.
and since the dataset are getting stored in a sequence ...but i want the last excel sheet to become the first sheet before it is getting saved....

1 solution

Based on your comment something like this would work
C#
int numSheets = this.Application.ActiveWorkbook.Sheets.Count;
this.Application.Worksheets[numSheets].Move(
     Before: this.Application.ActiveWorkbook.Sheets[1]);

or create that worksheet first - it depends on how you are creating the workbook/worksheets
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900