Excel 创建31 个 工作表

时间:2024-04-23 00:32:09
Sub AddSheets()
Dim i As Integer
Dim DaysInt As Integer
Dim NameStr As String DaysInt = DateAdd("m", , Now) - Now NameStr = Month(Now) & "-" Application.DisplayAlerts = False For i = Sheets.Count To Step -
If Sheets(i).Name <> ActiveSheet.Name Then
Sheets(i).Delete
End If
Next ActiveSheet.Name = NameStr & "" For i = To DaysInt
Sheets().Copy After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = NameStr & CStr(i)
Next Application.DisplayAlerts = True
End Sub

参见:  http://zhidao.baidu.com/link?url=ZZXXm8c-d-SEiKh9HXv0w6U5LxESX65PAqd2DDznhhHSbh2yVeJyPCbeTGwd7jJ3hFnFGC-pDwI6Wa134fiDxa