Dim x As Integer
Dim sh As Worksheet
For x = 1 To 31
Set sh = Sheets.Add
With sh
.Name = x & "日"
Sheets("日报模板").Range("1:15").Copy sh.Range("A1")
End With
Next x
End Sub
Dim x As Integer
Dim wb As Workbook
Application.ScreenUpdating = False
For x = 2 To 32
Sheets(x).Copy
Set wb = ActiveWorkbook
With wb
.SaveAs ThisWorkbook.Path & "/3月/" & Sheets(x).Name & ".xlsx"
.Close True
End With
Next x
Application.ScreenUpdating = True
End Sub
代码:
Sub 合并表格()
Dim mypath As String
Dim f As String
Dim ribao As Workbook
Application.ScreenUpdating = False
mypath = ThisWorkbook.Path & "/3月/"
f = Dir(ThisWorkbook.Path & "/3月/*.xlsx")
Do
Workbooks.Open (mypath & f)
With ActiveWorkbook
.Sheets(1).Move after:=ThisWorkbook.Sheets(Sheets.Count)
End With
f = Dir
Loop Until Len(f) = 0
Application.ScreenUpdating = True
End Sub