Spalten aus *.txt
12.02.2003 17:32:18
Ingo
ich habe mir hier aus den umfangreichen Sammlungen einen Code für das Speichern und Einlesen von/nach Tabellen in *.txt besorgt und klappt auch alles ganz toll.Jetzt stehe ich vor dem Problem das nicht jedes mal alle Daten aus der *.txt benötigt werden sondern z.B. nur die der 3,7,10 Spalte.Wie muss ich die Anweisung abändern ?
Vielen Dank für einen Tip oder sogar die entsprechende Änderung.
Gruß, Ingo
Sub StrassenEinlesen()
Dim Pfad As String
Pfad = Application.ActiveWorkbook.Path
If Dir(Pfad & "\Verwaltung\Programm\Tabellen\Strassen.txt") = "" Then Exit Sub
Dim intRow As Integer, intCol As Integer
Dim strTxt As String
Sheets("Strassen").Range("A1").CurrentRegion.ClearContents
Open Pfad & "\Verwaltung\Programm\Tabellen\Strassen.txt" For Input As #1
Do Until EOF(1)
intRow = intRow + 1
intCol = 0
Line Input #1, strTxt
Do Until InStr(strTxt, ";") = 0
intCol = intCol + 1
Sheets("Strassen").Cells(intRow, intCol) = Left(strTxt, InStr(strTxt, ";") - 1)
strTxt = Right(strTxt, Len(strTxt) - InStr(strTxt, ";"))
Loop
Sheets("Strassen").Cells(intRow, intCol + 1) = strTxt
Loop
Close
End Sub