ich nutze folgenden Code um Daten aus einer CSV Datei in eine Tabelle zu importieren.
Dies funktioniert auch wunderbar.
Allerdings benötigt mein Rechner dafür bei 6.700 Zeilen ca. 15 min..
Gibt es die Möglichkeit dies besser/schlanker zu gestalten.
Sub Volumenimport()
Dim QuellDatei As String 'Speicherort der Textdatei
Dim Zeile As Integer 'Laufvariable
Dim Inhalt As String 'Inhalt der Textdatei
Dim strDelimit$
Dim arrSrc
Application.ScreenUpdating = False
Application.DisplayAlerts = False
'Tabellenblatt aktivieren und leeren
ThisWorkbook.Worksheets("VolumeD").Activate
ActiveSheet.Range("A1:AP10000").ClearContentsy
'Startwert zuweisen
Zeile = 0
strDelimit = "," ' Trennzeichen der CSV-Datensätze
'QuellDatei ansprechen
QuellDatei = ThisWorkbook.Path & "\Volumen.csv"
'QuellDatei öffnen
Open QuellDatei For Input As #1
'Informationen in das Tabellenblatt eintragen
Do While Not EOF(1) 'Schleife bis DatenEnde
On Error Resume Next
'Inhalt der Quelldatei zeilenweise einlesen
Line Input #1, Inhalt
arrSrc = Split(Inhalt, strDelimit)
Cells(Zeile + 1, 1) = arrSrc(0)
Cells(Zeile + 1, 2) = arrSrc(1)
Cells(Zeile + 1, 3) = arrSrc(2)
Cells(Zeile + 1, 4) = arrSrc(3)
Cells(Zeile + 1, 5) = arrSrc(4)
Cells(Zeile + 1, 6) = arrSrc(5)
Cells(Zeile + 1, 7) = arrSrc(6)
Cells(Zeile + 1, 8) = arrSrc(7)
Cells(Zeile + 1, 9) = arrSrc(8)
Cells(Zeile + 1, 10) = arrSrc(9)
Cells(Zeile + 1, 11) = arrSrc(10)
Cells(Zeile + 1, 12) = arrSrc(11)
Cells(Zeile + 1, 13) = arrSrc(12)
Cells(Zeile + 1, 14) = arrSrc(13)
Cells(Zeile + 1, 15) = arrSrc(14)
Cells(Zeile + 1, 16) = arrSrc(15)
Cells(Zeile + 1, 17) = arrSrc(16)
Cells(Zeile + 1, 18) = arrSrc(17)
Cells(Zeile + 1, 19) = arrSrc(18)
Cells(Zeile + 1, 20) = arrSrc(19)
Cells(Zeile + 1, 21) = arrSrc(20)
Cells(Zeile + 1, 22) = arrSrc(21)
Cells(Zeile + 1, 23) = arrSrc(22)
Cells(Zeile + 1, 24) = arrSrc(23)
Cells(Zeile + 1, 25) = arrSrc(24)
Cells(Zeile + 1, 26) = arrSrc(25)
Cells(Zeile + 1, 27) = arrSrc(26)
Cells(Zeile + 1, 28) = arrSrc(27)
Cells(Zeile + 1, 29) = arrSrc(28)
Cells(Zeile + 1, 30) = arrSrc(29)
Cells(Zeile + 1, 31) = arrSrc(30)
Cells(Zeile + 1, 32) = arrSrc(31)
Cells(Zeile + 1, 33) = arrSrc(32)
Cells(Zeile + 1, 34) = arrSrc(33)
Cells(Zeile + 1, 35) = arrSrc(34)
Cells(Zeile + 1, 36) = arrSrc(35)
Cells(Zeile + 1, 37) = arrSrc(36)
Cells(Zeile + 1, 38) = arrSrc(37)
Cells(Zeile + 1, 39) = arrSrc(38)
Cells(Zeile + 1, 40) = arrSrc(39)
Cells(Zeile + 1, 41) = arrSrc(40)
Cells(Zeile + 1, 42) = arrSrc(41)
Zeile = Zeile + 1
Loop
'Quelldatei schliessen
Close #1
Columns("A:AP").Select
Selection.Replace What:="""", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
Es wäre toll wenn Ihr mir hierbei helfen könntet.
Gruß
Timo