AW: Inhaltsverzeichnis automatisch
21.09.2020 10:37:07
Werner
Hallo,
keine Ahnung was du hast. Die ausgeblendeten Blätter bleiben doch unberücksichtigt.
Dein Zähler intInhaltZaehler muss ins If ws.Visible .... End if.
Es macht heute keinen Sinn mehr Laufvariable as Integer zu deklarieren.
Option Explicit
Private Sub Worksheet_Activate() 'Neue Idee
Dim loInhaltZaehler As Long, ws As Worksheet
loInhaltZaehler = 8
Tabelle1.Range("A6:Z100").Clear
For Each ws In ThisWorkbook.Worksheets
If ws.Index > 1 Then
If ws.Visible = True Then
'Abfrage Name
Tabelle1.Cells(loInhaltZaehler, 2) = ws.Name
'Hyperlinks Name
Tabelle1.Cells(loInhaltZaehler, 2).Hyperlinks.Add Anchor:=Cells(loInhaltZaehler, 2), _
_
Address:="", SubAddress:="'" & ws.Name & "'!A1", TextToDisplay:=ws.Name
'Formatierung Name
With Cells(loInhaltZaehler, 2)
.Font.Color = vbBlack
.Font.Underline = xlUnderlineStyleNone
.Font.Size = 10
End With
'Abfrage Bearbeitungsstand
Tabelle1.Cells(loInhaltZaehler, 3) = ws.Range("E5")
'Formatierung Bearbeitungsstand
If Cells(loInhaltZaehler, 3) = "Offen" Then
With Cells(loInhaltZaehler, 3)
.Font.Color = vbWhite
.Font.Bold = True
.Font.Size = 9
.Interior.ThemeColor = xlThemeColorAccent6
.HorizontalAlignment = xlCenter
End With
ElseIf Cells(loInhaltZaehler, 3) = "Erledigt" Then
With Cells(loInhaltZaehler, 3)
.Font.Bold = True
.Font.Size = 9
.Interior.Color = 5296274
.HorizontalAlignment = xlCenter
End With
Else
Cells(loInhaltZaehler, 3).Clear
End If
'Formatierung Nummerierung
Cells(loInhaltZaehler, 1) = loInhaltZaehler - 7
Cells(loInhaltZaehler, 1).Font.Bold = True
loInhaltZaehler = loInhaltZaehler + 1
End If
End If
Next ws
Range("B7").Value = "Arbeitsblatt"
Range("C7").Value = "Stand"
Range("C7").HorizontalAlignment = xlCenter
Range("B7:C7").Font.Bold = True
Columns("B:C").EntireColumn.AutoFit
End Sub
Gruß Werner