Sub
CSV_Importieren()
Application.ScreenUpdating =
False
Name0 = ActiveWorkbook.Name
ResSheet =
"SgE-Z (BOR@SIM)"
ImpSheet =
"CSV-Import"
ModelCol_ =
"X"
ModelCol = Range(ModelCol_ +
"1"
).Column
ImpCol_ =
"Y"
ImpCol = Range(ImpCol_ +
"1"
).Column
ResColS_ =
"AR"
ResColS = Range(ResColS_ +
"1"
).Column
ResColSaD_ =
"GJ"
ResColSaD = Range(ResColSaD_ +
"1"
).Column
ResColE_ =
"LJ"
ResColE = Range(ResColE_ +
"1"
).Column
Pfad1 = Sheets(ResSheet).Cells(69, ModelCol) +
"\" + Sheets(ResSheet).Cells(70, ModelCol) + "
\output\"
ImpRow = 71
Columns(ResColS_ +
":"
+ ResColE_).
Select
Selection.EntireColumn.Hidden =
False
While
Sheets(ResSheet).Cells(ImpRow, ImpCol) <>
"-"
If
Sheets(ResSheet).Cells(ImpRow, ImpCol) =
"+"
Then
ActModel = Sheets(ResSheet).Cells(ImpRow, ModelCol)
ActVehicleType = Sheets(ResSheet).Cells(ImpRow, 3) +
" "
+ Sheets(ResSheet).Cells(ImpRow, 4)
<span style=
"color:#e74c3c"
>
If
Dir(Pfad1 + ActModel +
".csv"
) <>
""
Then
Name (Pfad1 + ActModel +
".csv"
)
As
(Pfad1 + ActModel +
".ssv"
)</span>
End
If
Workbooks.OpenText Filename:=Pfad1 + ActModel +
".ssv"
, Origin:=xlWindows, StartRow:=1, _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=
False
, _
Tab:=
False
, Semicolon:=
True
, Comma:=
False
, Space:=
False
, Other:=
False
, FieldInfo:=Array(1, 1)
Name1 = ActiveWorkbook.Name
Cells.
Select
Selection.Copy
Windows(Name0).Activate
Sheets(ImpSheet).
Select
Range(
"A1"
).
Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=
False
, Transpose:=
False
Sheets(ResSheet).
Select
Select
Case
ActVehicleType
Case
"STAG TL V1"
Range(ResColS_ +
"203:"
+ ResColE_ +
"203"
).
Select
Case
"STAG TW V1"
Range(ResColS_ +
"205:"
+ ResColE_ +
"205"
).
Select
Case
"STAG GTW V3"
Range(ResColS_ +
"207:"
+ ResColE_ +
"207"
).
Select
Case
"STAG GTZ V3"
Range(ResColS_ +
"209:"
+ ResColE_ +
"209"
).
Select
Case
"STAG FLIRT V2"
Range(ResColS_ +
"211:"
+ ResColE_ +
"211"
).
Select
Case
"STAG FLIRT V3"
Range(ResColS_ +
"213:"
+ ResColE_ +
"213"
).
Select
End
Select
Application.CutCopyMode =
False
Selection.Copy
Sheets(ResSheet).Cells(ImpRow, ResColS).
Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
False
, Transpose:=
False
Windows(Name1).Activate
ActiveWorkbook.Close
If
Dir(Pfad1 + ActModel +
".ssv"
) <>
""
Then
Name (Pfad1 + ActModel +
".ssv"
)
As
(Pfad1 + ActModel +
".csv"
)
End
If
Windows(Name0).Activate
End
If
ImpRow = ImpRow + 1
Wend
Range(ImpCol_ +
"67"
).
Select
ActiveCell.FormulaR1C1 =
"=TODAY()"
Range(ImpCol_ +
"67"
).
Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
False
, Transpose:=
False
Application.CutCopyMode =
False
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=2
Range(ResColS_ +
"7"
).
Select
ActiveWindow.FreezePanes =
False
ActiveWindow.FreezePanes =
True
ActiveWindow.SmallScroll Down:=50
Application.ScreenUpdating =
True
Range(ResColSaD_ +
"5"
).
Select
End
Sub