且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在所有现有的Excel工作表之后如何添加工作表?

更新时间:2023-12-01 10:27:22

您可以在之后添加工作表位置,即该代码在最后一个工作表之后添加工作表(由 objWrkBk.Sheets(objWrkBk.Sheets.Count)提供)其中 objWrkBk.Sheets.Count)是添加之前的工作表数量。

You can add sheets in the After position, ie this code adds the sheet after the last worksheet (provided by objWrkBk.Sheets(objWrkBk.Sheets.Count)) where objWrkBk.Sheets.Count) is the number of sheets prior to the addition.

Set objXL = CreateObject("Excel.Application")
Set objWrkBk = objXL.Workbooks.Add
Set objWrkSht = objWrkBk.Sheets.Add(, objWrkBk.Sheets(objWrkBk.Sheets.Count))