Option
Explicit
Sub
DoIt()
Const
TABELLEN
As
String
=
"Tabelle9,Tabelle2,Tabelle19"
Dim
arrTab()
As
String
, x
As
Long
Dim
oWbSource
As
Excel.Workbook, oWbTarget
As
Excel.Workbook
Dim
oWsh
As
Excel.Worksheet, sI
As
Long
Dim
strPath
As
String
Application.ScreenUpdating =
False
arrTab = Split(TABELLEN,
","
)
Set
oWbSource = ThisWorkbook
Sheets(arrTab(0)).Copy
Set
oWbTarget = ActiveWorkbook
For
x = 1
To
UBound(arrTab)
With
oWbTarget
sI = .Sheets.Count
oWbSource.Sheets(arrTab(x)).Copy After:=.Sheets(sI)
For
Each
oWsh
In
.Sheets
With
oWsh.UsedRange
.Value = .Value
End
With
Next
oWsh
End
With
Next
x
With
oWbTarget
Application.DisplayAlerts =
False
strPath = ThisWorkbook.Path &
"\" & "
XX XX
" & Format(DateSerial(Year(Now), Month(Now), 0), "
YYYY-MM")
.SaveAs strPath, xlOpenXMLWorkbook
.Close
False
End
With
Application.DisplayAlerts =
True
Application.ScreenUpdating =
True
Set
oWbSource =
Nothing
Set
oWbTarget =
Nothing
Set
oWsh =
Nothing
End
Sub