AW: Zellen sperren
18.10.2020 19:41:30
Nepumuk
Hallo Marc,
da ist eine Formel drin. Daher:
Option Explicit
Private Sub Worksheet_Calculate()
Unprotect
Range("F12:F500").Locked = Cells(9, 7).Text = "Doppel (entfällt)"
Protect
End Sub
Private Sub CommandButton1_Click()
If Cells(1, 1).Value + Cells(3, 1).Value + Cells(4, 1).Value = 0 Then
Unprotect
Application.Wait Time + TimeSerial(0, 0, 5)
With Range("H2:H7").Font
.Name = "Arial"
.FontStyle = "Fett"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = 255
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
If Cells(4, 1).Value = 1 Or Cells(5, 1).Value = 1 Then
With Range("H2:H7").Font
.Name = "Arial"
.FontStyle = "Fett"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
End If
Protect
End If
End Sub
Gruß
Nepumuk