1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
| 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).A ctivate
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 |
Partager