Blatt- bzw. Mappenschutz
04.09.2003 13:17:42
Daniel G
Ich habe da ein "kleines" Problem. Wenn ich folgenden Code ausführe, dann bekomme ich immer die Meldung, dass der Schutz noch aktiv sei und deswegen Rows und Alignements nicht geändert werden können.
Kann mir da jmd helfen?
Private Sub CommandButton2_Click()
Dim bereich As Range
Dim wrb As Workbook
Dim lastcell As Range
For Each wrb In Workbooks
With wrb
If (Visible = True) Then
.Activate
MsgBox "Datei" & .Name & "ist eben aktiviert worden und hat" & .Worksheets.Count & "Sheets."
ActiveWorkbook.Unprotect password:="passwort"
ActiveSheet.Unprotect password:="passwort"
Set bereich = Range(Cells(1, 1), Cells(xlCellTypeLastCell, 16))
With bereich
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.Font.Name = "arial"
.Font.Size = 8
.Font.ColorIndex = 1
.Rows.AutoFit
End With
End If
End With
ActiveWorkbook.Protect password:="passwort"
ActiveSheet.Protect password:="passwort"
Next wrb
End Sub