|
Tipp 0101
|
Leere Zeilen in einer Tabelle löschen
|
|
|
Autor/Einsender: Datum: |
|
Angie 23.07.2001 |
|
Entwicklungsumgebung: |
|
Excel 97 |
|
|
Mit folgendem Beispiel werden die leeren Zeilen in einer Tabelle gelöscht. Zur Überprüfung,
ob die Zeilen wirklich leer sind, wird hier die Tabellenfunktion ANZAHL2
(WorksheetFunction.CountA) benutzt.
|
|
|
Sub DeleteEmptyRows()
Dim optCalcMode As Long
Dim nRowsCnt As Long
Dim nRow As Long
With Worksheets(1)
If Application.WorksheetFunction.CountA(.Cells) > 0 Then
optCalcMode = Application.Calculation
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
nRowsCnt = .Cells.Find(What:="*", _
After:=.Range("A1"), SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row - 1
For nRow = nRowsCnt To 1 Step -1
If Application.WorksheetFunction.CountA( _
.Rows(nRow).EntireRow) = 0 Then
.Rows(nRow).EntireRow.Delete
End If
Next nRow
Application.Calculation = optCalcMode
Application.ScreenUpdating = True
End If
End With
End Sub
|
|
|
|
|
|
Die im Download befindliche *.bas-Datei kann in Excel im VB-Editor importiert werden.
|
|
Windows-Version |
95 |
|
|
98/SE |
|
|
ME |
|
|
NT |
|
|
2000 |
|
|
XP |
|
|
Vista |
|
|
Win
7 |
|
|
|
Excel-Version |
95 |
|
|
97 |
|
|
2000 |
|
|
2002
(XP) |
|
|
2003 |
|
|
2007 |
|
|
2010 |
|
|
|
|
Download (1,5 kB)
|
Downloads bisher: [ 2010 ]
|
|
|