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
| Private Sub CommandButton1_Click()
Dim DerLig As Long
'récupère la dernière ligne remplie sur base de la colonne A
DerLig = Sheets("Feuil1").Cells(Columns(1).Cells.Count, 1).End(xlUp).Row
DerLig1 = Sheets("Feuil1").Cells(Columns(2).Cells.Count, 1).End(xlUp).Row
DerLig2 = Sheets("Feuil1").Cells(Columns(3).Cells.Count, 1).End(xlUp).Row
DerLig3 = Sheets("Feuil1").Cells(Columns(4).Cells.Count, 1).End(xlUp).Row
DerLig4 = Sheets("Feuil1").Cells(Columns(5).Cells.Count, 1).End(xlUp).Row
DerLig5 = Sheets("Feuil1").Cells(Columns(6).Cells.Count, 1).End(xlUp).Row
DerLig6 = Sheets("Feuil1").Cells(Columns(7).Cells.Count, 1).End(xlUp).Row
DerLig7 = Sheets("Feuil1").Cells(Columns(8).Cells.Count, 1).End(xlUp).Row
DerLig8 = Sheets("Feuil1").Cells(Columns(9).Cells.Count, 1).End(xlUp).Row
DerLig9 = Sheets("Feuil1").Cells(Columns(10).Cells.Count, 1).End(xlUp).Row
DerLig10 = Sheets("Feuil1").Cells(Columns(11).Cells.Count, 1).End(xlUp).Row
DerLig11 = Sheets("Feuil1").Cells(Columns(12).Cells.Count, 1).End(xlUp).Row
DerLig12 = Sheets("Feuil1").Cells(Columns(13).Cells.Count, 1).End(xlUp).Row
DerLig13 = Sheets("Feuil1").Cells(Columns(14).Cells.Count, 1).End(xlUp).Row
DerLig14 = Sheets("Feuil1").Cells(Columns(15).Cells.Count, 1).End(xlUp).Row
DerLig15 = Sheets("Feuil1").Cells(Columns(16).Cells.Count, 1).End(xlUp).Row
DerLig16 = Sheets("Feuil1").Cells(Columns(17).Cells.Count, 1).End(xlUp).Row
DerLig17 = Sheets("Feuil1").Cells(Columns(18).Cells.Count, 1).End(xlUp).Row
DerLig18 = Sheets("Feuil1").Cells(Columns(19).Cells.Count, 1).End(xlUp).Row
DerLig19 = Sheets("Feuil1").Cells(Columns(20).Cells.Count, 1).End(xlUp).Row
DerLig20 = Sheets("Feuil1").Cells(Columns(21).Cells.Count, 1).End(xlUp).Row
DerLig21 = Sheets("Feuil1").Cells(Columns(22).Cells.Count, 1).End(xlUp).Row
'Place la valeur de la combobox dans la première cellule vide de la colonne A
Sheets("Feuil1").Cells(DerLig + 1, 1) = Formulaire.TextBox1.Value
Sheets("Feuil1").Cells(DerLig1 + 1, 1) = Formulaire.TextBox8.Value
Sheets("Feuil1").Cells(DerLig2 + 1, 1) = Formulaire.TextBox7.Value
Sheets("Feuil1").Cells(DerLig3 + 1, 1) = Formulaire.TextBox6.Value
Sheets("Feuil1").Cells(DerLig4 + 1, 1) = Formulaire.TextBox5.Value
Sheets("Feuil1").Cells(DerLig5 + 1, 1) = Formulaire.TextBox4.Value
Sheets("Feuil1").Cells(DerLig6 + 1, 1) = Formulaire.TextBox3.Value
Sheets("Feuil1").Cells(DerLig7 + 1, 1) = Formulaire.TextBox2.Value
Sheets("Feuil1").Cells(DerLig8 + 1, 1) = Formulaire.ComboBox1.Value
Sheets("Feuil1").Cells(DerLig9 + 1, 1) = Formulaire.TextBox10.Value
Sheets("Feuil1").Cells(DerLig10 + 1, 1) = Formulaire.TextBox9.Value
Sheets("Feuil1").Cells(DerLig11 + 1, 1) = Formulaire.ComboBox2.Value
Sheets("Feuil1").Cells(DerLig12 + 1, 1) = Formulaire.TextBox11.Value
If Formulaire.OptionButton1 = True Then
Sheets("Feuil1").Cells(DerLig13 + 1, 1) = Formulaire.OptionButton1.Value
ElseIf Formulaire.OptionButton2 = True Then
Sheets("Feuil1").Cells(DerLig13 + 1, 1) = Formulaire.OptionButton1.Value
End If
Sheets("Feuil1").Cells(DerLig14 + 1, 1) = Formulaire.TextBox12.Value
If Formulaire.CheckBox1 = True Then
Sheets("Feuil1").Cells(DerLig15 + 1, 1) = Formulaire.CheckBox1.Value
ElseIf Formulaire.CheckBox2 = True Then
Sheets("Feuil1").Cells(DerLig15 + 1, 1) = Formulaire.CheckBox2.Value
End If
If Formulaire.CheckBox3 = True Then
Sheets("Feuil1").Cells(DerLig16 + 1, 1) = Formulaire.CheckBox3.Value
ElseIf Formulaire.CheckBox2 = True Then
Sheets("Feuil1").Cells(DerLig16 + 1, 1) = Formulaire.CheckBox5.Value
End If
If Formulaire.CheckBox7 = True Then
Sheets("Feuil1").Cells(DerLig17 + 1, 1) = Formulaire.CheckBox7.Value
ElseIf Formulaire.CheckBox9 = True Then
Sheets("Feuil1").Cells(DerLig17 + 1, 1) = Formulaire.CheckBox9.Value
End If
If Formulaire.CheckBox4 = True Then
Sheets("Feuil1").Cells(DerLig18 + 1, 1) = Formulaire.CheckBox4.Value
ElseIf Formulaire.CheckBox6 = True Then
Sheets("Feuil1").Cells(DerLig18 + 1, 1) = Formulaire.CheckBox6.Value
End If
Sheets("Feuil1").Cells(DerLig19 + 1, 1) = Formulaire.TextBox14.Value
If Formulaire.CheckBox8 = True Then
Sheets("Feuil1").Cells(DerLig20 + 1, 1) = Formulaire.CheckBox8.Value
ElseIf Formulaire.CheckBox10 = True Then
Sheets("Feuil1").Cells(DerLig20 + 1, 1) = Formulaire.CheckBox10.Value
End If
Sheets("Feuil1").Cells(DerLig21 + 1, 1) = Formulaire.TextBox13.Value
End Sub |