wie ist es möglich das mir ein Makro alle Zeilen löscht wo in Spalte G nichts steht. Das Makro sollte in Zeile 5 beginnen zu laufen.
Danke,
Alex
Sub Loesche_Leere_In_G()
Dim meSH As Worksheet
Dim iCalc As Integer
Set meSH = Sheets("Tabelle1") 'Tabelle anpassen
With Application
iCalc = .Calculation
.ScreenUpdating = False
.EnableEvents = False
.Calculation = xlCalculationManual
With meSH
With .UsedRange.Columns(.UsedRange.Columns.Count).Offset(0, 1)
.FormulaR1C1 = "=IF(OR(RC7<>"""",ROW()<5),ROW(),TRUE)"
meSH.UsedRange.Sort Key1:=.Cells(1, 1), Order1:=xlAscending, Header:=xlNo
On Error Resume Next
.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ß TinoSub löScheWennGleer()
Dim zeiLe As Long
Const spAlte = 7 'G
Application.ScreenUpdating = False
With ActiveSheet
For zeiLe = .Cells.SpecialCells(xlLastCell).Row To 5 Step -1
If .Cells(zeiLe, spAlte) = "" Then .Rows(zeiLe).Delete Shift:=xlUp
Next
End With
Application.ScreenUpdating = True
End Sub
Sub löScheWennGleer()
Dim zeiLe As Long
Const spAlte = 7 'G
Application.ScreenUpdating = False
With ActiveSheet
For zeiLe = .Cells(Rows.Count, 1).End(xlUp).Row To 5 Step -1
If .Cells(zeiLe, spAlte) = "" Then .Rows(zeiLe).Delete Shift:=xlUp
Next
End With
Application.ScreenUpdating = True
End Sub
Gruss, Jogy