ich habe jetzt ein Makro geschrieben, was mir die Werte aus mehreren Dateien ausliest und in eine neue Tabelle einfügt.
allerdings übernimmt Excel die Formatierung der alten Tabelle.
Gibt es da etwas womit ich nur die Werte übernehmen kann?
Vielen Dank im voraus.
Gruß Alex
Sub test1()
Dim Datei As String
Dim Verzeichnis As String
Dim Tmp As String
Dim I As Integer
Dim WS2 As Worksheet
Dim WS1 As Worksheet
Dim WS As Worksheet
Dim Motor As String
Application.ScreenUpdating = False
' Tabellen auswählen
Workbooks("Werte.xlsm").Activate
Set WS = Workbooks(ActiveWorkbook.name).Worksheets("Tabelle5")
Workbooks("Werte.xlsm").Activate
Set WS1 = Workbooks(ActiveWorkbook.name).Worksheets("Tabelle3")
'I = Spalten aus Verzeichnisliste
For I = 2 To 10
If WS.Range("A" & I) = Empty Then
Exit For
End If
Datei = WS.Cells(I, 2)
Verzeichnis = WS.Cells(I, 1)
'Motornummer definieren
Motor = Mid(Verzeichnis, 63, 22)
Application.EnableEvents = False
Workbooks.Open Verzeichnis & "\" & Datei, ReadOnly:=True
Application.EnableEvents = True
Workbooks(Datei).Activate
Set WS2 = Workbooks(ActiveWorkbook.name).Worksheets("Tabelle1")
Dim Spalte1 As String
Dim Spalte2 As String
Dim Spalte3 As String
Dim Spalte4 As String
Dim Spalte5 As String
Dim Spalte6 As String
WS2.Range("C22:C53").Copy
WS1.Cells(82, I).Insert
WS2.Range("D22:D53").Copy
WS1.Cells(114, I).Insert
WS2.Range("E22:E53").Copy
WS1.Cells(146, I).Insert
WS2.Range("F22:F53").Copy
WS1.Cells(178, I).Insert
WS2.Range("G22:G53").Copy
WS1.Cells(210, I).Insert
WS2.Range("H22:H53").Copy
WS1.Cells(242, I).Insert
Application.CutCopyMode = False
'Motornummer eintragen
WS1.Cells(81, I).Value = Motor
Application.DisplayAlerts = False
Workbooks(Datei).Close
Next I
End Sub