Bonjour carcharodon-carcharias,
Merci de me répondre aussi vite.
Je joins une partie de ma programmation car le reste est peu être un peu long, et mon USF plus mes 3 classeurs ne passeront pas à l'envoi.
Cette partie comprends donc le bouton de commande permettant de remplir un des classeurs de planning. Comme tu peux le voir je remplis une plage en couleur pour un événement, et il peut en avoir plusieurs sur la même ligne.
J'ai un onglet saisie qui fonctionne, et un autre qui me permet de consulter mes classeurs et de les modifier. Je bute sur le moyen de pouvoir rapatrier dans mes combobox correspond aux 52 semaines (et aux en-têtes de colonnes) le N° de la semaine correspondant au début de la plage de couleur, dans un autre combobox l'autre N° correspondant à la fin de la plage, et ce pour tous les événements avec plusieurs par ligne (donc 2 combobox par plage).
Private Sub CommandButton2_Click()
Workbooks("Etudes.xls").Activate
Dim Arr(), a As Integer, Arr1(), A1 As Integer
Arr = Array("combobox25")
For a = 0 To UBound(Arr)
If Me.Controls(Arr(a)) = "" Then
MsgBox "Année d'enregistrement 'Planning Etudes' non choisie", vbOKOnly + vbCritical, " OUBLI "
Me.Controls(Arr(a)).SetFocus
Exit Sub
End If
Next
Workbooks("Etudes.xls").Sheets(ComboBox25.Value).Activate
Dim X As Long, Sem1 As Byte, Sem2 As Byte, Sem3 As Integer, Sem4 As Integer, Sem5 As Integer, Sem6 As Integer, _
Sem7 As Integer, Sem8 As Integer, Sem9 As Integer, Sem10 As Integer, Sem11 As Integer, Sem12 As Integer, Sem13 As Integer, _
Sem14 As Integer, Sem15 As Integer, Sem16 As Integer, Sem17 As Integer, Sem18 As Integer
Sem1 = Me.ComboBox7
Sem2 = Me.ComboBox8
Sem3 = Me.ComboBox9
Sem4 = Me.ComboBox10
Sem5 = Me.ComboBox11
Sem6 = Me.ComboBox12
Sem7 = Me.ComboBox13
Sem8 = Me.ComboBox14
Sem9 = Me.ComboBox15
Sem10 = Me.ComboBox16
Sem11 = Me.ComboBox17
Sem12 = Me.ComboBox18
Sem13 = Me.ComboBox19
Sem14 = Me.ComboBox20
Sem15 = Me.ComboBox21
Sem16 = Me.ComboBox22
X = Range("A65536").End(xlUp).Row + 1
Arr1 = Array("combobox1")
For A1 = 0 To UBound(Arr1)
If Me.Controls(Arr1(A1)) = "" Then
MsgBox "Commune 'Planning Etudes' non spécifiée", vbOKOnly + vbExclamation, " ATTENTION "
Me.Controls(Arr1(A1)).SetFocus
Exit Sub
End If
Next
Range("A" & X).Value = ComboBox1.Value
Range("B" & X).Value = ComboBox2.Value
Range("C" & X).Value = TextBox1.Value
Range("D" & X).Value = ComboBox3.Value
Range("E" & X).Value = ComboBox5.Value
Range("F" & X).Value = ComboBox6.Value
Range("G" & X).Value = TextBox2.Value
Range("H" & X).Value = TextBox3.Value
Range("I" & X).Value = ComboBox4.Value
If (Sem1 + Sem2) = 0 Then
GoTo c1
Else
Range(Cells(X, Sem1 + 9), Cells(X, Sem2 + 9)).Interior.ColorIndex = 4
End If
c1: If (Sem3 + Sem4) = 0 Then
GoTo c2
Else
Range(Cells(X, Sem3 + 9), Cells(X, Sem4 + 9)).Interior.ColorIndex = 8
End If
c2: If (Sem5 + Sem6) = 0 Then
GoTo c3
Else
Range(Cells(X, Sem5 + 9), Cells(X, Sem6 + 9)).Interior.ColorIndex = 43
End If
c3: If (Sem7 + Sem8) = 0 Then
GoTo c4
Else
Range(Cells(X, Sem7 + 9), Cells(X, Sem8 + 9)).Interior.ColorIndex = 3
End If
c4: If (Sem9 + Sem10) = 0 Then
GoTo c5
Else
Range(Cells(X, Sem9 + 9), Cells(X, Sem10 + 9)).Interior.ColorIndex = 38
End If
c5: If (Sem11 + Sem12) = 0 Then
GoTo c6
Else
Range(Cells(X, Sem11 + 9), Cells(X, Sem12 + 9)).Interior.ColorIndex = 6
End If
c6: If (Sem13 + Sem14) = 0 Then
GoTo c7
Else
Range(Cells(X, Sem13 + 9), Cells(X, Sem14 + 9)).Interior.ColorIndex = 7
End If
c7: If (Sem15 + Sem16) = 0 Then
GoTo fin
Else
Range(Cells(X, Sem15 + 9), Cells(X, Sem16 + 9)).Interior.ColorIndex = 10
End If
fin: MsgBox " Enregistrement des données ETUDES effectué ", vbOKOnly + vbInformation, " Fin de la saisie affichée "
End Sub
Merci pour ton aide