Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
500to504
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
500to504
500to504
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

Problem bei Datenübernahme aus Textdatei

Problem bei Datenübernahme aus Textdatei
13.10.2004 16:12:48
Peter
Hallo zusammen,
ich komme mit einem Problem nicht weiter.
Ich bekomme über den Download aus einem anderen Programm eine txt.datei. Für die komfortablere Weiterverarbeitung in Excel ist es besser, daß überflüssige Zeilen mit bestimmten Zeichenfolgen gelöscht werden.
Ich habe bisher das nachfolgende Makro benutzt, das aber wegen der großen Datenmengen viel zu langsam ist.
Könnt Ihr mir helfen? Gibt es eine schnellere Alternative?
Dim i, Zeile As Integer
Zeile = Cells(Rows.Count, 1).End(xlUp).Row
For i = Zeile To 1 Step -1
If Cells(i, 1).Value = "1 KO" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "Hiera" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "----" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "-----" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "------" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "-------" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "SKS" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "Au" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "o" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "Ber" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "Hi" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "Be" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "Ve" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "Ze" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "Gr" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "Grupp" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "B" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "P" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "G" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "E" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "A" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "44 NA" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "Ko" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "ode" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "Beric" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "F1=Hil" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "F1=H" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "Kostens" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "Bericht" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "1 KOST" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "44 NAD" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "44 NADL" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "SKS -" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "Ausw" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "Hier" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "44 N" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "ZNR" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "Beri" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "1 K" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "BEZ" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "PER" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "GEM" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "EMP" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "ABG" Then
Cells(i, 1).EntireRow.Delete
End If
If Cells(i, 1).Value = "Gruppe" Then
Cells(i, 1).EntireRow.Delete
End If
Next i
AW: Problem bei Datenübernahme aus Textdatei
13.10.2004 16:20:04
Matthias
Hallo Peter (Lustig?),
Verwende die Select Case-Anweisung. Da kannst Du alle Prüfwerte hintereinander schreiben.
siehe Excel-Hilfe.
Gruß Matthias
AW: Problem bei Datenübernahme aus Textdatei
Peter
Hallo Matthias,
Dein Hinweis hat mir sehr geholfen. Danke
AW: Problem bei Datenübernahme aus Textdatei
Peter
Hallo Peter,
denke, dass es schneller geht, wenn Du mit einem Zeichen jeweils einmal durch die Tabelle gehst. Danach mit der nächsten, so wird bei jedem Durchlauf die Tabelle kleiner. was sich auch auf die Laufzeit auswirken sollte.
Vielleicht gehts aber auch mit find() schneller..
Nicht traurig sein..
Gruß
Peter
AW: Problem bei Datenübernahme aus Textdatei
Peter
Hallo
vielen Dank für Deinen Hinweis, ich habe aber schon eine anderen Lösungsvorschlag verarbeitet.
Anzeige
AW: Problem bei Datenübernahme aus Textdatei
u
Dim i, Zeile As Integer
Zeile = Cells(Rows.Count, 1).End(xlUp).Row
For i = Zeile To 1 Step -1
Select Case Cells(i, 1)
Case "1 KO", "Hiera", "----", "-----", "------", "-------", "SKS", "Au", _
"o", "Ber", "Hi", "Be", "Ve", "Ze", "Gr", "Grupp" 'etcpp.
Cells(i, 1).EntireRow.Delete
End Select
Next i
AW: Problem bei Datenübernahme aus Textdatei
Peter
Hallo,
Dein Makro hat mir sehr geholfen. Vielen Dank dafür
Ohne VBA - dafür mit Autofilter
Boris
Hi Peter,
Deine Einträge stehen in A1:A...
Schreibe in eine Hilfsspalte - z.B. B - in B1 diese Formel:
=ODER(A1={"1 KO"."Hiera"."---"})
die du natürlich mit allen Einträgen innerhalb der { } fütterst (immer in "" und getrennt mit Punkt), die unerwünscht sind.
Formel runterkopieren.
Ergebnis ist entweder WAHR oder FALSCH.
Anschließend Autofilter über die Hilfsspalte, filtern nach WAHR.
Dann Filterzeilen markieren und manuell löschen - fertig.
Grüße Boris
http://www.excelformeln.de
Anzeige
vielen Dank für Deinen Hinweis
Peter
.

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige