ich möchte ein Textfile einlesen:
Sub Einlesen()
'On Error Resume Next
Dim strTxt As String, myArr, lngL As Long, wks As Worksheet
Dim strFile As String
With Application.FileDialog(1)
.AllowMultiSelect = False
.InitialFileName = "D:\Daten\*.txt*"
.InitialView = 2
If .Show = -1 Then
strFile = .SelectedItems(1)
Else: End
End If
End With
If strFile = "" Then Exit Sub
If strFile "" Then
lngL = 1 'ab Zeile
Open strFile For Input As #1
'Set wks = Workbooks.Add(1).Sheets(1).Sheets(1)
Set wks = ThisWorkbook.Sheets("Sheet1")
Do Until EOF(1)
Line Input #1, strTxt
myArr = Split(strTxt, vbTab)
With wks
.Range(.Cells(lngL, 1), .Cells(lngL, UBound(myArr) + 1)) = myArr
End With
lngL = lngL + 1
Loop
Close #1
End If
End Sub
Allerdings möchte ich den Inhalt des Textfiles (Ist nur eine Spalte) erst in Spalte C machen, A steht schon was drin und B soll leer bleiben.
Wie überspringe ich die beiden ersten ?
Danke
Jockel