Sub
ReadfromCSVSimple(fname
As
Variant
,
Optional
fs
As
String
=
";"
)
Dim
hfile
As
Integer
Dim
lAnzahl
As
Long
Dim
OneLine
As
String
Dim
myArr
As
Variant
Dim
myArrRows
As
Variant
Dim
lnglast
As
Long
Dim
zeichen
As
Variant
Dim
iCnt
As
Integer
Dim
inhalt
ThisWorkbook.Worksheets(
"Projektübersicht"
).
Select
lnglast = Cells(Rows.Count, 1).
End
(xlUp).Row
If
IsEmpty(Cells(lnglast, 1))
Then
lnglast = Cells(lnglast, 1).
End
(xlUp).Row
lnglast = lnglast + 1
hfile = FreeFile
Open fname
For
Input
As
#hfile
inhalt = Input(LOF(hfile), hfile)
Close #hfile
If
UBound(Split(inhalt, Chr(10))) > 0
Then
MsgBox inhalt
Else
Exit
Sub
OneLine = Split(inhalt, Chr(10))(1)
If
OneLine <>
""
Then
MsgBox OneLine
Else
MsgBox
"die zweite Zeile ist leer"
myArr = Split(OneLine,
";"
)
MsgBox UBound(myArr)
If
UBound(myArr) > 3
Then
With
Worksheets(
"Projektübersicht"
)
.Cells(lnglast, 3) = Replace(myArr(1), Chr$(4), vbNullString)
.Cells(lnglast, 4) = Replace(myArr(2), Chr$(4), vbNullString)
.Cells(lnglast, 5) = Replace(myArr(3), Chr$(4), vbNullString)
.Cells(lnglast, 6) = Replace(myArr(4), Chr$(4), vbNullString)