Sub
Schaltfläche1_Klicken()
Dim
strFileName
As
String
, arrDaten, arrTmp, lngR
As
Long
, lngLast
As
Long
Const
cstrDelim
As
String
=
","
With
Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect =
False
.Title =
"Datei wählen"
.InitialFileName =
"D:\Marktanalyse\Ausgangsdaten AKS-Export\*.csv"
If
.Show = -1
Then
strFileName = .SelectedItems(1)
End
If
End
With
If
strFileName <>
""
Then
Application.ScreenUpdating =
False
Open strFileName
For
Input
As
#1
arrDaten = Split(Input(LOF(1), 1), vbCrLf)
Close #1
For
lngR = 1
To
UBound(arrDaten)
TextFileTextQualifier = xlTextQualifierDoubleQuote
arrTmp = Split(arrDaten(lngR), cstrDelim)
If
UBound(arrTmp) > -1
Then
With
ActiveSheet
lngLast = .Cells(Rows.Count, 1).
End
(xlUp).Row + 1
lngLast = Application.Max(lngLast, 5)
.Cells(lngLast, 1).Resize(, UBound(arrTmp) + 1) _
= Application.Transpose(Application.Transpose(arrTmp))
End
With
End
If
Next
lngR
End
If
End
Sub