以下為自動新增指定名稱及數量的空白工作表巨集:
Sub add_sheet()
Dim shtnr As Integer
Dim shtname As String
shtnr = InputBox("請輸入新增工作表數量: ")
shtname = InputBox("請輸入新增工作表的前綴名稱: ")
For i = 1 To shtnr
Worksheets.Add
ActiveSheet.Name = shtname & "-" & i
Next
End Sub
沒有留言:
張貼留言