Excel 建立31 個 工做表

 

Sub AddSheets()
Dim i As Integer
Dim DaysInt As Integer
Dim NameStr As String

DaysInt = DateAdd("m", 1, Now) - Now

NameStr = Month(Now) & "-"

Application.DisplayAlerts = False

For i = Sheets.Count To 1 Step -1
If Sheets(i).Name <> ActiveSheet.Name Then
Sheets(i).Delete
End If
Next

ActiveSheet.Name = NameStr & "1"


For i = 2 To DaysInt
Sheets(1).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-pDwI6Wa134fiDxaurl

相關文章
相關標籤/搜索