|
Sub gj23w98()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each sht In Sheets
If sht.Name <> ActiveSheet.Name Then sht.Delete
Next
Set wk = ThisWorkbook
p = ThisWorkbook.Path & "\"
f = Dir(p & "*.xls")
Do While f <> ""
If f <> ThisWorkbook.Name Then
Set ws = Workbooks.Open(p & f)
ws.Sheets("客房收入").Copy after:=wk.Sheets(wk.Sheets.Count)
wk.Sheets(wk.Sheets.Count).Name = Mid(Split(f, ".")(0), 6, 4) & "A"
ws.Sheets("餐饮").Copy after:=wk.Sheets(wk.Sheets.Count)
wk.Sheets(wk.Sheets.Count).Name = Mid(Split(f, ".")(0), 6, 4) & "B"
ws.Close False
End If
f = Dir
Loop
Sheets(1).Activate
MsgBox "ok"
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
|
|