根据创建时间对 Excel 工作表进行逆序排序/反转 Excel 工作表
我正在使用 Microsoft interop excel 来自动化 Excel 工作簿 其中我有很多工作表(比如 40 个),这些工作表是在几秒甚至更短的时间内创建的 现在我必须以相反的顺序呈现工作表,即首先创建的工作表在打开时应该首先出现(当前它最后出现)简而言之,我必须以相反的顺序或按创建时
对此事进行排序 任何帮助
谢谢
I'm using Microsoft interop excel to automate the excel workboook
in which i have many worksheets(say 40) which have been created at in seconds gap or even less
now i have to present the worksheet in reverse order i.e the sheet which was created first should come first while opening(currently it comes last) in short I have to sort the excel sheet in reverse order or by time of creation
any help in this matter
thnx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
据我所知,Excel不存储每个工作表的创建日期和时间。然而,每个新工作表都会添加到工作簿每个工作表的末尾。
因此,您可以根据这个假设颠倒顺序。
下面是一个用于执行此操作的 VBA 宏,您只需将其调整为互操作或 C#:
它会解析从最后一张之前的一张到第一张的工作表,并将每个工作表移动到最后一个位置。
As far as I know, Excel doesn't store the date and time of creation of each sheet. Yet, every new sheet is added at the end of every sheets of the workbook.
So, you can reverse the order based on this hypothesis.
Here is a VBA macro to do this, you just have to adapt it to interop or C#:
It parses sheets from one sheet before the last one to the first one and move each sheet to the last position.
因此,如果您有 Excel 文件中的工作簿工作表,并且需要对工作表字母表进行排序:
So, if you have a Worksheets of Workbook in excel file and you need to sort Worksheets alphabet: