Sub
NachDruckversion()
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
Workbooks.Open Filename:=ThisWorkbook.Path &
"\Druckversion.xlsm"
With
Workbooks(2)
With
.Sheets(
"Zweite"
)
.Cells.Clear
End
With
With
.Sheets(
"Dritte"
)
.Cells.Clear
End
With
End
With
With
Workbooks(1)
With
.Sheets(
"Zweiteseite"
)
lngLast = .Cells.Find(
"*"
, [A1], , , xlByRows, xlPrevious).Row
With
.Columns(
"C:H"
)
Set
rngQuelle = Range(.Rows(1), .Rows(lngLast))
arrCH = rngQuelle.Value
End
With
With
.Columns(
"P:T"
)
Set
rngQuelle = Range(.Rows(1), .Rows(lngLast))
arrRT = rngQuelle.Value
End
With
End
With
Set
rngZiel = Workbooks(2).Sheets(
"Zweite"
).Range(
"A1"
)
rngZiel.Resize(UBound(arrCH, 1), UBound(arrCH, 2)).Value = arrCH
Set
rngZiel = Workbooks(2).Sheets(
"Zweite"
).Range(
"G1"
)
rngZiel.Resize(UBound(arrRT, 1), UBound(arrRT, 2)).Value = arrRT
With
.Sheets(
"Dritteseite"
)
lngLast = .Cells.Find(
"*"
, [A1], , , xlByRows, xlPrevious).Row
With
.Columns(
"C:H"
)
Set
rngQuelle = Range(.Rows(1), .Rows(lngLast))
arrCH = rngQuelle.Value
End
With
With
.Columns(
"P:T"
)
Set
rngQuelle = Range(.Rows(1), .Rows(lngLast))
arrRT = rngQuelle.Value
End
With
End
With
Set
rngZiel = Workbooks(2).Sheets(
"Dritte"
).Range(
"A1"
)
rngZiel.Resize(UBound(arrCH, 1), UBound(arrCH, 2)).Value = arrCH
Set
rngZiel = Workbooks(2).Sheets(
"Dritte"
).Range(
"G1"
)
rngZiel.Resize(UBound(arrRT, 1), UBound(arrRT, 2)).Value = arrRT
End
With
Workbooks(2).Close
True
eHandler:
Select
Case
Err.Number
Case
0
Case
Else
MsgBox
"Fehler bei der Ausführung"
End
Select
Application.ScreenUpdating =
True
End
Sub