用新名称复制工作表

将不胜感激你的帮助,在搞清楚这个小问题。

我想用我想要的名称多次复制一个Excel工作表。 我能够通过让我问这个名字应该是什么 – 但是有没有办法通过编写这20个左右的标签名来做到这一点。

这是我到目前为止 –

Dim name As String Dim x As Integer x = ActiveWorkbook.Worksheets.Count name = Application.InputBox("Put down the name", "Add worksheet") If name = "" Then Exit Sub Worksheets(1).Copy after:=Worksheets(x) ActiveSheet.Name = name 

请让我知道,如果这是可能的事情。 非常感谢你的帮助。

谢谢。

你需要做一个循环。

 Dim ws As Worksheet Set ws = Worksheets("WorksheetWithNames") Dim y As Integer For y = 1 To 10 ' < enter the number of sheets you want. 'copy the sheet 'rename the sheet 'assuming you have names in column A ActiveSheet.Name = ws.Cells(y, 1) Next 

有一个模块,你可以插入这里提供的链接

其要点是要做到以下几点:

 Click Insert > Module, and paste the following code in the Module Window. Sub Copier () Dim x As Integer x = InputBox("Enter number of times to copy Sheet1") For numtimes = 1 To x ActiveWorkbook.Sheets("Sheet1").Copy _ After:=ActiveWorkbook.Sheets("Sheet1") Next End Sub