Option
Explicit
Sub
NachDruckversion()
Dim
wbQ
As
Workbook, wbZ
As
Workbook
Dim
arrCH()
As
Variant
Dim
arrRT()
As
Variant
Dim
rngZiel
As
Range
Dim
rngQuelle
As
Range
Dim
lngLast
As
Long
If
Workbooks.Count > 1
Then
Exit
Sub
With
Sheets(
"Zweiteseite"
)
If
Application.WorksheetFunction.CountA(.Cells) = 0
Then
Exit
Sub
End
With
With
Sheets(
"Dritteseite"
)
If
Application.WorksheetFunction.CountA(.Cells) = 0
Then
Exit
Sub
End
With
On
Error
GoTo
eHandler
Application.ScreenUpdating =
False
Set
wbQ = ActiveWorkbook
Workbooks.Open Filename:=ThisWorkbook.Path &
"\Druckversion.xlsm"
Set
wbZ = ActiveWorkbook
wbZ.Sheets(
"Zweite"
).Cells.Clear
wbZ.Sheets(
"Dritte"
).Cells.Clear
lngLast = wbQ.Sheets(
"Zweiteseite"
).Cells.Find(
"*"
, [A1], , , xlByRows, xlPrevious).Row
wbQ.Sheets(
"Zweiteseite"
).Range(
"C1:H"
& lngLast).Copy wbZ.Sheets(
"Zweite"
).Range(
"A1"
)
wbQ.Sheets(
"Zweiteseite"
).Range(
"P1:T"
& lngLast).Copy wbZ.Sheets(
"Zweite"
).Range(
"G1"
)
lngLast = wbQ.Sheets(
"Dritteseite"
).Cells.Find(
"*"
, [A1], , , xlByRows, xlPrevious).Row
wbQ.Sheets(
"Dritteseite"
).Range(
"C1:H"
& lngLast).Copy wbZ.Sheets(
"Dritte"
).Range(
"A1"
)
wbQ.Sheets(
"Dritteseite"
).Range(
"P1:T"
& lngLast).Copy wbZ.Sheets(
"Dritte"
).Range(
"G1"
)
wbZ.Close
True
eHandler:
Select
Case
Err.Number
Case
0
Case
Else
MsgBox
"Fehler bei der Ausführung"
End
Select
Application.ScreenUpdating =
True
End
Sub