Excel 워크시트 31개 만들기

1652 단어 Excel
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

좋은 웹페이지 즐겨찾기