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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
| Private Sub CommandButton1_Click()
Dim ctrl As Control
Dim Colonne As Integer
Dim DerLigne As Integer
DerLigne = Sheets("LISTE DE TIR").Range("A65000").End(xlUp).Row + 1 ' définie ce qu'est la dernière ligne écrite
' Permet de verifier si toutes les cases indispensables sont remplies
If UserForm1.ComboBox1 = "" Or UserForm1.ComboBox2 = "" Or UserForm1.ComboBox3 = "" Or UserForm1.ComboBox4 = "" Or UserForm1.ComboBox5 = "" Or UserForm1.ComboBox6 = "" Or UserForm1.ComboBox7 = "" Or UserForm1.ComboBox8 = "" Or UserForm1.ComboBox9 = "" Or UserForm1.TextBox1 = "" Or UserForm1.TextBox2 = "" Or UserForm1.TextBox9 = "" Or UserForm1.TextBox10 = "" Or UserForm1.TextBox11 = "" Or UserForm1.TextBox12 = "" Or UserForm1.TextBox13 = "" Or UserForm1.TextBox14 = "" Or UserForm1.TextBox15 = "" Or UserForm1.TextBox16 = "" Or UserForm1.TextBox21 = "" Then
MsgBox " INCOMPLET"
GoTo JumpToHere ' permet de sauter une étape
' permet de verifier dans le cas où le test est exploitable si les résultats sont bien rentrés
End If
TextBox22.Value = (ComboBox1.Value & ComboBox2.Value & ComboBox3.Value) 'TextBox22=date dans colonne A
TextBox23.Value = (ComboBox4.Value & ":" & ComboBox5.Value)
If UserForm1.ComboBox8 = "OUI" And (UserForm1.TextBox17 = "" Or UserForm1.TextBox18 = "" Or UserForm1.TextBox19 = "" Or UserForm1.TextBox20 = "") Then
MsgBox " INCOMPLET"
GoTo JumpToHere ' permet de sauter une étape
End If
' permet de verifier dans le cas où le test est NON exploitable si les résultats sont bien rentrés
For Each ctrl In UserForm1.Controls
Colonne = Val(ctrl.Tag)
If Colonne > 0 Then Sheets("LISTE DE TIR").Cells(DerLigne, Colonne) = ctrl 'ici contrôle de ça s'écrit où + écriture
Sheets("LISTE DE TIR").Unprotect ' enlève la protection de la feuille
Next
' fait la mise en page
Derniereligne = Sheets("LISTE DE TIR").Range("A65000").End(xlUp).Rows.Select
Call Macro1
Selection.Offset(0, 1).Select
Call Macro2
Selection.Offset(0, 1).Select
Call Macro3
Selection.Offset(0, 1).Select
Call Macro1
Selection.Offset(0, 1).Select
Call Macro2
ActiveCell.Value = "h"
Selection.Offset(0, 1).Select
Call Macro3
Selection.Offset(0, 1).Select
Call Macro4
Selection.Offset(0, 1).Select
Call Macro4
Selection.Offset(0, 1).Select
Call Macro1
Selection.Offset(0, 1).Select
Call Macro2
ActiveCell.Value = "%"
Selection.Offset(0, 1).Select
Call Macro2
Selection.Offset(0, 1).Select
Call Macro2
ActiveCell.Value = "+"
Selection.Offset(0, 1).Select
Call Macro2
Selection.Offset(0, 1).Select
Call Macro2
ActiveCell.Value = "%"
Selection.Offset(0, 1).Select
Call Macro2
Selection.Offset(0, 1).Select
Call Macro2
ActiveCell.Value = "+"
Selection.Offset(0, 1).Select
Call Macro2
Selection.Offset(0, 1).Select
Call Macro2
ActiveCell.Value = "%"
Selection.Offset(0, 1).Select
Call Macro2
Selection.Offset(0, 1).Select
Call Macro2
ActiveCell.Value = "+"
Selection.Offset(0, 1).Select
Call Macro2
Selection.Offset(0, 1).Select
Call Macro2
ActiveCell.Value = "%"
Selection.Offset(0, 1).Select
Call Macro3
Selection.Offset(0, 1).Select
Call Macro4
Selection.Offset(0, 1).Select
Call Macro4
Selection.Offset(0, 1).Select
Call Macro4
Selection.Offset(0, 1).Select
Call Macro4
Selection.Offset(0, 1).Select
Call Macro4
Selection.Offset(0, 1).Select
Call Macro4
Selection.Offset(0, 1).Select
Call Macro4
Selection.Offset(0, 1).Select
Call Macro4
Selection.Offset(0, 1).Select
Call Macro4
Selection.Offset(0, 1).Select
Call Macro4
Selection.Offset(0, 1).Select
Call Macro4
Selection.Offset(0, 1).Select
Call Macro4
Selection.Offset(0, 1).Select
Call Macro4
Selection.Offset(0, 1).Select
Call Macro4
Selection.Offset(0, 1).Select
Call Macro4
Selection.Offset(0, -37).Select
Unload UserForm1
Call ListeLecteursAmovible
JumpToHere:
Sheets("LISTE DE TIR").Protect , AllowSorting:=True, AllowFiltering:=True
ActiveWorkbook.Save
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:="E:\copy.xlsm" ' mettre un répertoire
Application.DisplayAlerts = True
End Sub |
Partager