ich möchte gern den Blattschutz aktivieren, sobald ich das aber tue bringt er mir die Fehlermeldung 91. Objektvariable oder with block nicht festgelegt.
Hab schon alle Häkchen im Blattschutz versucht... ohne Erfolg :/
Wo liegt den das Problem? Um Hilfe bin ich sehr Dankbar!!
Gruß Marc
Private Sub CommandButton1_Click()
Dim rngBer As Range, rngC As Range
If ComboBox1.Value = "" Then MsgBox "Bitte wählen Sie ein BLM aus."
If ComboBox2.Value = "" Then MsgBox "Bitte wählen Sie eine Schicht aus."
With Sheets("Schichteinteilung")
Application.Calculation = xlCalculationManual
For i = 12 To 70
If ComboBox2.Value = "nur Frühschicht" Then
.Cells(i, Rows(1).Find(ComboBox1).Column) = 1 'die Passage wird in jeder Bedingung markiert
Else
End If
If ComboBox2.Value = "nur Spätschicht" Then
.Cells(i, Rows(1).Find(ComboBox1).Column) = 2
Else
End If
If ComboBox2.Value = "Gerade KW Spät" Then
Set rngBer = .Cells(i, 5)
For Each rngC In rngBer
If rngC.Value = 1 Then
.Cells(i, Rows(1).Find(ComboBox1).Column) = 2
ElseIf rngC.Value = 2 Then
.Cells(i, Rows(1).Find(ComboBox1).Column) = 1
End If
Next
End If
If ComboBox2.Value = "Ungerade KW Spät" Then
Set rngBer = .Cells(i, 5)
For Each rngC In rngBer
If rngC.Value = 1 Then
.Cells(i, Rows(1).Find(ComboBox1).Column) = 1
ElseIf rngC.Value = 2 Then
.Cells(i, Rows(1).Find(ComboBox1).Column) = 2
End If
Next
End If
Next
End With
Application.Calculation = xlCalculationAutomatic
End Sub