AW: Tabellenende
25.02.2007 10:25:57
Erich
Hallo Wolfgang,
was meinst du mit "letzte tatsächlich beschriebene Zeile"?
Die letzte Zeile, in der ein Wert oder eine Formel steht - unabhängig von der Länge, d. h. auch wenn der Wert eine leere Zeichenkette ist?
Oder die Zeile mit dem letzten nichtleeren Wert?
Probier mal diese Funktionen (funzen auch als Tabellenfunktionen) aus:
Function LZFoSp&(sp%, Optional akt As Boolean)
If akt Then Application.Volatile
LZFoSp = IIf(Cells(Rows.Count, sp) > "", _
Rows.Count, _
Cells(Rows.Count, sp).End(xlUp).Row)
End Function
Function LZWeSp&(sp%, Optional akt As Boolean)
Dim rng As Range
If akt Then Application.Volatile
Set rng = Columns(sp).Find("*", Cells(1, sp), xlValues, , , xlPrevious)
If rng Is Nothing Then
LZWeSp = 1
Else
LZWeSp = rng.Row
End If
End Function
Function LZFoTab&(Optional akt As Boolean)
Dim jj%, mm&, ee&
If akt Then Application.Volatile
With ActiveSheet.UsedRange
mm = .Columns(.Columns.Count).Column
For jj = .Columns(1).Column To .Columns(.Columns.Count).Column
mm = LZFoSp(jj)
If ee < mm Then ee = mm
Next jj
End With
LZFoTab = ee
End Function
Function LZWeTab&(Optional akt As Boolean)
Dim rng As Range
If akt Then Application.Volatile
Set rng = Cells.Find("*", Cells(1, 1), xlValues, , xlByRows, xlPrevious)
If rng Is Nothing Then LZWeTab = 1 Else LZWeTab = rng.Row
End Function
Rückmeldung wäre nett! - Grüße von Erich aus Kamp-Lintfort