Hallo zusammen,
ich wollte hier mein Code abänderen das man über eine Combobox denn "For i =" ab-Wert bestimmen kann. dazu wollte ich mir den Wert der Combobox aus der A-Spalte (werte beginnen ab Zeile 12) ziehen. Leider unterstützt er die Methode nicht. Wo liegt hier der Fehler?
Danke für Hilfe!!!
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")
.Unprotect
Application.Calculation = xlCalculationManual
For i = Cells(.Find(what:=ComboBox3, LookAt:=xlWhole).Row, 1) To 70 ' hier liegt das Problem
If ComboBox2.Value = "nur Frühschicht" Then
.Cells(i, Rows(1).Find(ComboBox1).Column) = 1
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
.Protect
End With
Application.Calculation = xlCalculationAutomatic
End Sub