AW: Leerzeilen löschen
06.08.2009 09:31:41
Tino
Hallo,
teste mal diesen Code, Tabellenname im Code noch anpassen.
Sub Loesche_Wenn_A_und_B_leer()
Dim iCalc As Integer
Dim Sh_Tabelle1 As Worksheet
Set Sh_Tabelle1 = Sheets("Tabelle1") 'Deine Tabelle anpassen
With Application
iCalc = .Calculation
.ScreenUpdating = False
.EnableEvents = False
.Calculation = xlCalculationManual
With Sh_Tabelle1
With .UsedRange.Columns(.UsedRange.Columns.Count).Offset(0, 1)
'=WENN(UND($A1="";$B1="");WAHR;ZEILE())
.FormulaR1C1 = "=IF(AND(RC1="""",RC2=""""),TRUE,ROW())"
Sh_Tabelle1.UsedRange.Sort .Cells(1, 1), xlAscending, , , , , , xlNo
On Error Resume Next
.Cells.SpecialCells(xlCellTypeFormulas, 4).EntireRow.Delete
On Error GoTo 0
.EntireColumn.Delete
End With
End With
.ScreenUpdating = True
.EnableEvents = True
.Calculation = iCalc
End With
End Sub
Gruß Tino