AW: Daten zusammenfügen und vergleichen
08.12.2015 19:36:04
Christoph
So vom essen zurück.
vielleicht kommen wir ja noch zu einer Lösung=)
Habe es jetzt besser gelöst und sollte nicht zu den Fehler kommen.
Hier jetzt nochmal alles.
Sub Zusammenfassen_CHRISTOPH()
'Const strPath As String = "C:\Users\acer\Desktop\Testherber\Archiv\" 'Pfad anpassen Dateien _
sind
Const strPath As String = "J:\P_VA_VE_Cost_Reduction\TEAM_Ordner\01_Daten sammeln\06_Business _
Case\" 'Pfad anpassen Dateien sind
Dim strDateiname As String
Dim wkbBook As Workbook
Dim lngLastRowQ As Long
Dim lngLastRowZ As Long
Dim lngLastCol As Long
Dim intCalc As Integer
On Error GoTo Fin
With Application
.ScreenUpdating = False
.AskToUpdateLinks = False
.EnableEvents = False
intCalc = .Calculation
.Calculation = xlCalculationManual
.DisplayAlerts = False
End With
'strDateiname = Dir$(ThisWorkbook.Path & "\*.xls")
strDateiname = Dir$(strPath & "*.xlsm")
Do While strDateiname ""
If strDateiname ThisWorkbook.Name Then
Set wkbBook = Workbooks.Open(strPath & strDateiname)
Call Bearbeiten
wkbBook.Close True ' Oder True, wenn gespeichert werden soll
Set wkbBook = Nothing
End If
strDateiname = Dir$()
Loop
Fin:
Set wkbBook = Nothing
With Application
.ScreenUpdating = True
.AskToUpdateLinks = True
.EnableEvents = True
.Calculation = intCalc
.DisplayAlerts = True
End With
If Err.Number 0 Then MsgBox "Error: " & _
Err.Number & " " & Err.Description
End Sub
Sub Bearbeiten()
Sheets("ACTION").Select
Dim Ez1 As Long 'erste Zeile
Dim Lz1 As Long 'letzte Zeile (wird ermittelt)
Dim Spalte1 As String
Dim Spalte2 As String
Dim Zeile%
Dim x
Spalte1 = "A"
Spalte2 = "E"
Spalte3 = "H"
Ez1 = ActiveSheet.Cells(Rows.Count, Spalte3).End(xlUp).Row + 1 'ermittelt erste Zeile
Lz1 = ActiveSheet.Cells(Rows.Count, Spalte2).End(xlUp).Row + 1 'ermitellt letzte Zeile
For Zeile = ActiveSheet.Cells(Rows.Count, 5).End(xlUp).Row To 1 Step -1
If Cells(Zeile, 5) "" Then
Cells(Zeile, 8) = "übernommen"
End If
Next
ActiveSheet.Range(Spalte1 & Ez1 & ":F" & Lz1).Copy
Windows("MUSTER.xlsm").Activate
Range("E1000000").Activate
Selection.End(xlUp).Select
ActiveCell.Offset(1, -4).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub