verdacht
26.06.2013 11:21:50
Tino
Hallo,
ich nehme an dies verhält sich wie mit dem UsedRange/Benutzter Bereich in einer normalen Tabelle.
Teste mal diese Variante
Sub Beispiel()
Dim oList As ListObject, rngLetzte As Range
Set oList = Tabelle1.ListObjects(1)
Set rngLetzte = FindLetzte(oList.Range)
MsgBox rngLetzte.Row
End Sub
Function FindLetzte(rngRange As Range) As Range
Dim LRow As Long, LCol As Long
Dim A As Long
With rngRange
On Error Resume Next
'Finde Zeile
LRow = .Find("*", , xlValues, xlWhole, xlByRows, xlPrevious, False, False).Row
LRow = Application.Max(LRow, .Find("*", , xlFormulas, xlWhole, xlByRows, xlPrevious).Row)
If LRow = 0 Then LRow = 1
'Finde Spalte
For A = .Columns(.Columns.Count).Column To .Columns(1).Column Step -1
LCol = .Columns(A).Find("*", , xlValues, xlWhole, xlByRows, xlPrevious).Column
LCol = Application.Max(LCol, .Columns(A).Find("*", , xlFormulas, xlWhole, xlByRows, xlPrevious).Column)
If LCol > 1 Then: LCol = A: Exit For
Next A
If LCol = 0 Then LCol = 1
Set FindLetzte = .Parent.Cells(LRow, LCol)
End With
End Function
Gruß Tino