Sub 新增檔案()
Dim P$, T$, xB As Workbook
P = ThisWorkbook.Path & "\"
T = Dir(P & "今日總表(均值排序)-*_*-(????-??-??).xls")
If T = "" Then Exit Sub
T = "今日總表(均值排序)-" & Split(Right(T, 16), ".xls")(0) & "_統計.xls"
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Sheets("統計").Copy
With ActiveWorkbook: .SaveAs Filename:=P & T, CreateBackup:=False: .Close: End With
MsgBox "新檔案建立完成! "
End Sub
Sub 新增檔案()
Dim S, P$, T$, xB As Workbook, N%
P = ThisWorkbook.Path & "\"
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each S In Array("均值", "尾數", "合數", "生肖", "五行", "八卦")
T = Dir(P & "今日總表(" & S & "排序)-*_*-(????-??-??).xls")
If T = "" Then GoTo 101
T = Left(T, 11) & Left(Right(T, 16), 12) & "_統計.xls"
Sheets("統計").Copy
With ActiveWorkbook: .SaveAs Filename:=P & T, CreateBackup:=False: .Close: End With
N = N + 1
101: Next
If N > 0 Then MsgBox "共建立 " & N & " 個新檔案! "
End Sub作者: ziv976688 時間: 2019-4-14 18:09