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-pDwI6Wa134fiDxa

你可能感兴趣的:(Excel)