AW: Leere Zellen löschen sehr langsam
11.03.2014 14:50:57
Tobias
Hallo, ich habe jetzt einiges versucht:
'*** bescheunigt das Makro
With Application
.ScreenUpdating = False
stCalc = .Calculation
.Calculation = xlCalculationManual
End With
With tab6
.activate
.Range(.Cells(4, 2), .Cells(letzte2, 17)).Select
Set Rng = Selection.SpecialCells(xlCellTypeBlanks)
If Not Rng Is Nothing Then
Rng.Delete shift:=xlUp
End If
End With
'*** Rücksetzen
With Application
.ScreenUpdating = True
If .Calculation stCalc Then .Calculation = stCalc
End With
und
'*** bescheunigt das Makro
With Application
.ScreenUpdating = False
stCalc = .Calculation
.Calculation = xlCalculationManual
End With
Dim rDel As Range
Set rDel = Nothing
Application.ScreenUpdating = False
For i = Letzte2 To 4 Step -1
For j = 2 To 17
If tab6.Cells(i, j) = "" Then
If rDel Is Nothing Then
Set rDel = tab6.Cells(i, j)
Else
Set rDel = Union(rDel, tab6.Cells(i, j))
End If
End If
Next j
Next i
If Not rDel Is Nothing Then
rDel.Delete shift:=xlUp
End If
Application.ScreenUpdating = True
'*** Rücksetzen
With Application
.ScreenUpdating = True
If .Calculation stCalc Then .Calculation = stCalc
End With
Es ist immer noch extrem langsam. Was meine Vermutung ist: In den befüllten Zellen steht sehr viel Text drin. Kann es sein, dass sich Excel bei obrigen Checks den ganzen Text in der Zelle anguckt? Wäre es möglich das bei dem Check abgebrochen wird, sobald Character.Count >0 ist? Ich kann mir nur vorstellen, dass es damit was zutun hat, zum Teil stehen in den Zellen Texte drin, die mehr als 1000 Zeichen haben. (Ich weiss natürlich, dass Excel kein Textprogramm ist, aber Aufgabe ist Aufgabe. )