Sub
Gruppen_zusammenführen()
Dim
oTargetBook
As
Object
Dim
oSourceBook
As
Object
Dim
sPfad
As
String
Dim
sDatei
As
String
Application.ScreenUpdating =
False
Application.DisplayAlerts =
False
Set
oTargetBook = ActiveWorkbook
"\\C:Users\Admin\..."
sDatei = Dir(
CStr
(sPfad &
"*.xlsx*"
))
Do
While
sDatei <>
""
Set
oSourceBook = Workbooks.Open(sPfad & sDatei,
False
,
True
)
oSourceBook.Sheets(2).Copy after:=oTargetBook.Sheets(oTargetBook.Sheets.Count)
On
Error
Resume
Next
oTargetBook.Sheets(oTargetBook.Sheets.Count).Name = sDatei
If
Err.Number <> 0
Then
Err.Number = 0
Err.Clear
End
If
On
Error
GoTo
0
oSourceBook.Close
False
sDatei = Dir()
Loop
Application.ScreenUpdating =
True
Application.DisplayAlerts =
True
Set
oTargetBook =
Nothing
Set
oSourceBook =
Nothing
End
Sub
Sub
Tabellenblätter_copy()
Dim
i
As
Integer
For
i = 2
To
9
Worksheets(i).Copy after:=Sheets(9)
ActiveSheet.UsedRange.Cells = ActiveSheet.UsedRange.Cells.Value
Next
i
End
Sub
Sub
Tabellenblätter_zusammenfassen()
Dim
i
As
Integer
Dim
Zusammenfassung
As
Worksheet
Set
Zusammenfassung = Worksheets(
"Zusammenfassung"
)
For
i = 10
To
17
Set
BereichZielTab = Worksheets(i).UsedRange
Set
LetzteZeileZusammenfassung = Worksheets(1).Cells(Rows.Count,
"A"
).
End
(xlUp)(2)
BereichZielTab.Copy Destination:=LetzteZeileZusammenfassung
Next
i
MsgBox
"Fertig!"
, vbInformation + vbOKOnly,
"Hinweis!"
End
Sub