AW: Einlesen Zeilennummer abhängig vom Inhalt ei
04.04.2012 18:13:44
ChrisL
Hi
Mein Fehler...
Der Code ist zwischen recht chaotisch, sorry dafür. Wie gesagt, wüsste man wofür du es brauchst, wäre die Lösung vermutlich einfacher.
Function ManassesAntiAutofilterSpezialfunktion(rng As Range) As Variant
Dim iZeile As Long
Application.Volatile
If Not Rows(rng.Row).Hidden And rng.Row > 1 Then
If rng Cells(IdentifyNext(rng.Row), 1) Then
For iZeile = rng.Row To 2 Step -1
If Cells(IdentifyPrevious(iZeile), 1) rng Then
ManassesAntiAutofilterSpezialfunktion = iZeile
Exit Function
End If
Next iZeile
End If
End If
ManassesAntiAutofilterSpezialfunktion = ""
End Function
Private Function IdentifyPrevious(iZeile As Long) As Long
Dim i As Long
For i = iZeile - 1 To 1 Step -1
If Not Rows(i).Hidden Then
IdentifyPrevious = i
Exit Function
End If
Next i
End Function
Private Function IdentifyNext(iZeile As Long) As Long
Dim i As Long
For i = iZeile + 1 To TrueLast()
If Not Rows(i).Hidden Then
IdentifyNext = i
Exit Function
End If
Next i
End Function
Private Function TrueLast() As Long
Dim i As Long
For i = 1 To 65536
If Cells(i, 1) = "" Then
TrueLast = i
Exit Function
End If
Next i
End Function
cu
Chris