Option
Compare Text
Const
Folder =
"D:\Test_Umgebung\Orders_xlsx"
Public
Sub
test2()
Dim
Datei
As
String
Dim
Verzeichnis
As
String
Dim
SaveDummy
As
Variant
Dim
Datum
As
Date
Dim
num
As
String
Dim
Filename
As
String
Dim
aktDate
As
Date
Dim
Wkb
As
Workbook, Fso
As
Object
, file
As
Object
, Zeile
As
Long
Dim
Wkb2
As
Workbook
aktDate =
"17.10.2017"
num =
"1"
With
Application
.ScreenUpdating =
False
.AskToUpdateLinks =
False
.DisplayAlerts =
False
End
With
Set
Fso = CreateObject(
"Scripting.FileSystemObject"
)
Workbooks.Open
"D:\Test_Umgebung\xls_File_pro_Migrationstag\UC50_SAFE_LAURA_"
& aktDate &
"--"
& num &
".xlsx"
Set
Wkb2 = Workbooks.Open(
"D:\Test_Umgebung\xls_File_pro_Migrationstag\UC50_SAFE_LAURA_"
& aktDate &
"--"
& num &
".xlsx"
)
For
Each
file
In
Fso.GetFolder(Folder).Files
If
Fso.GetExtensionName(file.Name)
Like
"xlsx"
And
Fso.GetBaseName(file.Name)
Like
"*orders*"
Then
Set
Wkb = GetObject(file.Path)
With
Wkb.Sheets(1)
If
Wkb.Sheets(1).Range(
"B2"
).Value = aktDate
Then
Zeile = Cells(Rows.Count, 1).
End
(xlUp).Row + 1
If
Zeile < 3
Then
Zeile = 3
.Range(
"A2"
).Copy: Cells(Zeile,
"A"
).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
.Range(
"B2"
).Copy: Cells(Zeile,
"B"
).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
.Range(
"C2"
).Copy: Cells(Zeile,
"C"
).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
.Range(
"D2"
).Copy: Cells(Zeile,
"D"
).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
.Range(
"E2"
).Copy: Cells(Zeile,
"E"
).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
.Range(
"F2"
).Copy: Cells(Zeile,
"F"
).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
.Range(
"G2"
).Copy: Cells(Zeile,
"G"
).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
.Range(
"H2"
).Copy: Cells(Zeile,
"H"
).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
.Range(
"I2"
).Copy: Cells(Zeile,
"I"
).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
.Range(
"J2"
).Copy: Cells(Zeile,
"J"
).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
End
If
End
With
Wkb.Close
False
End
If
Next
With
Application
.ScreenUpdating =
True
.AskToUpdateLinks =
True
.DisplayAlerts =
True
End
With
Wkb2.Save
Workbooks.Close
End
Sub