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
| Private Sub CommandButton1_Click()
If Not verif(Feuil3.Range("G19"), _
Feuil3.Range("I19"), Feuil3.Range("J19"), Feuil3.Range("K19")) Then
x = MsgBox("Les sommes sont fausses !", vbOKOnly, "Attention !")
Exit Sub
Else
ligne = ActiveCell.Row
With Feuil4
.Range("B" & CStr(ligne)) = Feuil3.Range("E19").Value
.Range("C" & CStr(ligne)) = Feuil3.Range("F19").Value
.Range("D" & CStr(ligne)) = Feuil3.Range("G19").Value
.Range("E" & CStr(ligne)) = Feuil3.Range("H19").Value
.Range("F" & CStr(ligne)) = Feuil3.Range("I19").Value
.Range("G" & CStr(ligne)) = Feuil3.Range("J19").Value
.Range("H" & CStr(ligne)) = Feuil3.Range("K19").Value
.Range("J" & CStr(ligne)) = Feuil3.Range("M19").Value
End With
End If
Unload Me
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub SpinButton1_SpinDown()
Dim ligne As Integer
Dim c As String
c = TextBox1.ControlSource
ligne = ActiveCell.Row + 1
If ligne = 45 Then Exit Sub
With Feuil4
Feuil3.Range("E19") = .Range("B" & CStr(ligne))
Feuil3.Range("F19") = .Range("C" & CStr(ligne))
Feuil3.Range("G19") = .Range("D" & CStr(ligne))
Feuil3.Range("H19") = .Range("E" & CStr(ligne))
Feuil3.Range("I19") = .Range("F" & CStr(ligne))
Feuil3.Range("J19") = .Range("G" & CStr(ligne))
Feuil3.Range("K19") = .Range("H" & CStr(ligne))
Feuil3.Range("M19") = .Range("J" & CStr(ligne))
End With
TextBox1.ControlSource = "PARAMETRE!E19"
TextBox2.ControlSource = "PARAMETRE!F19"
TextBox3.ControlSource = "PARAMETRE!G19"
TextBox4.ControlSource = "PARAMETRE!H19"
TextBox5.ControlSource = "PARAMETRE!I19"
TextBox6.ControlSource = "PARAMETRE!J19"
TextBox7.ControlSource = "PARAMETRE!K19"
TextBox8.ControlSource = "PARAMETRE!M19"
Feuil4.Cells(ligne, 2).Activate
End Sub
Private Sub SpinButton1_SpinUp()
Dim ligne As Integer
Dim c As String
c = TextBox1.ControlSource
ligne = ActiveCell.Row - 1
If ligne = 9 Then Exit Sub
With Feuil4
Feuil3.Range("E19") = .Range("B" & CStr(ligne))
Feuil3.Range("F19") = .Range("C" & CStr(ligne))
Feuil3.Range("G19") = .Range("D" & CStr(ligne))
Feuil3.Range("H19") = .Range("E" & CStr(ligne))
Feuil3.Range("I19") = .Range("F" & CStr(ligne))
Feuil3.Range("J19") = .Range("G" & CStr(ligne))
Feuil3.Range("K19") = .Range("H" & CStr(ligne))
Feuil3.Range("M19") = .Range("J" & CStr(ligne))
End With
TextBox1.ControlSource = "PARAMETRE!E19"
TextBox2.ControlSource = "PARAMETRE!F19"
TextBox3.ControlSource = "PARAMETRE!G19"
TextBox4.ControlSource = "PARAMETRE!H19"
TextBox5.ControlSource = "PARAMETRE!I19"
TextBox6.ControlSource = "PARAMETRE!J19"
TextBox7.ControlSource = "PARAMETRE!K19"
TextBox8.ControlSource = "PARAMETRE!M19"
Feuil4.Cells(ligne, 2).Activate
End Sub
Private Sub UserForm_Initialize()
Dim ligne As Integer
ligne = Feuil4.Range("B8").End(xlDown).Row + 1
With Feuil4
Feuil3.Range("E19") = ""
Feuil3.Range("F19") = ""
Feuil3.Range("G19") = ""
Feuil3.Range("H19") = ""
Feuil3.Range("I19") = ""
Feuil3.Range("J19") = ""
Feuil3.Range("K19") = ""
Feuil3.Range("M19") = ""
End With
TextBox1.ControlSource = "PARAMETRE!E19"
TextBox2.ControlSource = "PARAMETRE!F19"
TextBox3.ControlSource = "PARAMETRE!G19"
TextBox4.ControlSource = "PARAMETRE!H19"
TextBox5.ControlSource = "PARAMETRE!I19"
TextBox6.ControlSource = "PARAMETRE!J19"
TextBox7.ControlSource = "PARAMETRE!K19"
TextBox8.ControlSource = "PARAMETRE!M19"
Feuil4.Cells(ligne, 2).Activate
End Sub
Function verif(ByVal s As Double, a As Double, b As Double, c As Double) As Boolean
verif = s = a + b + c
End Function |
Partager