AW: Bereichsnamen und Zeilenanzahl feststellen
18.12.2017 14:31:48
Robert
Hallo,
vielleicht kann man den Fehler wie folgt umgehen:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Dim n As Name
For Each n In ThisWorkbook.Names
If ActiveSheet.Name = Mid(n, 2, InStr(n, "!") - 2) Then
If Not Intersect(ActiveCell, Range(n)) Is Nothing Then
MsgBox "Aktive Zelle: " & ActiveCell.Address(0, 0) & vbLf _
& "Bereichsname: " & n.Name & vbLf _
& "Anzahl Zeilen im Bereich: " & Range(n).Rows.Count & vbLf _
& "Zeilen bis Bereichsende: " & Range(n).Rows.Count + Range(n).Row - 1 - ActiveCell.Row
Exit Sub
End If
End If
Next n
End Sub
Gruß
Robert