Gruppe
Allgemein
Problem
Aus der in Zelle B1 genannten Arbeitsmappe soll das 1. Tabellenblatt in diese Arbeitsmappe importiert werden.
StandardModule: Modul1
Sub TabImport()
Dim wkb As Workbook
Dim sFile As String
Application.ScreenUpdating = False
sFile = Range("B1").Value
If Dir(sFile) = "" Then
Beep
MsgBox "Datei wurde nicht gefunden!"
Exit Sub
End If
On Error GoTo ERRORHANDLER
Application.EnableEvents = False
Set wkb = Workbooks.Open(sFile, False)
With ThisWorkbook
Worksheets(1).Copy after:=.Worksheets(.Worksheets.Count)
End With
wkb.Close savechanges:=False
ERRORHANDLER:
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub