Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
896to900
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
896to900
896to900
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

Makro modifizieren

Makro modifizieren
16.08.2007 11:45:00
Nico
Tag zusammen,
wir kann ich folgendes Makro, welches jede Zeile löscht, in der Spalte A leer ist, so umbauen, daß jede Zeile gelöscht wird, in der Spalte B leer ist.

Sub DeleteRowIfEmptyCell()
Dim intRow As Integer, intLastRow As Integer
intLastRow = Cells.SpecialCells(xlCellTypeLastCell).Row
For intRow = intLastRow To 1 Step -1
If Application.CountA(Rows(intRow)) = 0 Then
intLastRow = intLastRow - 1
Else
Exit For
End If
Next intRow
For intRow = intLastRow To 1 Step -1
If IsEmpty(Cells(intRow, 1)) Then
Rows(intRow).Delete
End If
Next intRow
End Sub


Danke im Voraus und Gruß
Nico

6
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Makro modifizieren
16.08.2007 11:50:43
Renee
Hello Nico,

statt
If IsEmpty(Cells(intRow, 1))
das
If IsEmpty(Cells(intRow, 2))


aber als zusätzliche Empfehlung würde ich noch alle Variablen, statt mit Integer mit Long definieren, da es mehr als 32218 Zeilen gibt!
Greetz Renee

AW: Makro modifizieren
16.08.2007 11:55:46
Nico
Vielen Dank schon mal, und wenn ich jetzt noch möchte, daß die Abfrage erst ab Zeile 13 anfängt und von 1-12 nichts gelöscht wird, auch wenn Spalte B leer ist ?

AW: Makro modifizieren
16.08.2007 12:15:00
Renee
Hi Nico,

statt
For intRow = intLastRow To 1 Step -1
das
For intRow = intLastRow To 13 Step -1


Greetz Renee

Anzeige
If IsEmpty(Cells(intRow, 2)) Then ... oT
16.08.2007 11:51:00
c0bRa

Kürzere Variante
16.08.2007 11:51:45
{Boris}
Hi Nico,
...daß jede Zeile gelöscht wird, in der Spalte B leer ist...

Sub til()
Range("B:B").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub


Grüße Boris

AW: Makro modifizieren
16.08.2007 11:52:00
chris
Hallo Nico,
so geht es auf Spalte B

Sub DeleteRowIfEmptyCell()
Dim intRow As Integer, intLastRow As Integer
intLastRow = Cells.SpecialCells(xlCellTypeLastCell).Row
For intRow = intLastRow To 1 Step -1
If Application.CountA(Rows(intRow)) = 0 Then
intLastRow = intLastRow - 1
Else
Exit For
End If
Next intRow
For intRow = intLastRow To 1 Step -1
If IsEmpty(Cells(intRow, 2)) Then
Rows(intRow).Delete
End If
Next intRow
End Sub


gruß Chris

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige