Bonjour,
Je souhaite ajouter une combobox pour définir la valeur de P.
Actuellement P est la valeur inscrite dans le cellule Cells(77, 2)
j'ai créer le combobox mais je n'ai pas su comment le lier avec le module.
Je pourrais renseigner la valeur du combobox dans une cellule puis tirer cette valeur depuis la cellule vers le module mais ça serait pas professionnel
Code du module:
Sub gg()
Dim C(1 To 12)
R = 2
S = 31
Do While R < 6
Z = 79
For x = S To S + 4
y = 2
C(1) = Cells(x, y)
C(2) = Cells(x, y) + Cells(x, y + 1)
C(3) = Cells(x, y) + Cells(x, y + 1) + Cells(x, y + 2)
C(4) = Cells(x, y) + Cells(x, y + 1) + Cells(x, y + 2) + Cells(x, y + 3)
C(5) = Cells(x, y) + Cells(x, y + 1) + Cells(x, y + 2) + Cells(x, y + 3) + Cells(x, y + 4)
C(6) = Cells(x, y) + Cells(x, y + 1) + Cells(x, y + 2) + Cells(x, y + 3) + Cells(x, y + 4) + Cells(x, y + 5)
C(7) = Cells(x, y) + Cells(x, y + 1) + Cells(x, y + 2) + Cells(x, y + 3) + Cells(x, y + 4) + Cells(x, y + 5) + Cells(x, y + 6)
C(8) = Cells(x, y) + Cells(x, y + 1) + Cells(x, y + 2) + Cells(x, y + 3) + Cells(x, y + 4) + Cells(x, y + 5) + Cells(x, y + 6) + Cells(x, y + 7)
C(9) = Cells(x, y) + Cells(x, y + 1) + Cells(x, y + 2) + Cells(x, y + 3) + Cells(x, y + 4) + Cells(x, y + 5) + Cells(x, y + 6) + Cells(x, y + 7) + Cells(x, y + 8)
C(10) = Cells(x, y) + Cells(x, y + 1) + Cells(x, y + 2) + Cells(x, y + 3) + Cells(x, y + 4) + Cells(x, y + 5) + Cells(x, y + 6) + Cells(x, y + 7) + Cells(x, y + 8) + Cells(x, y + 9)
C(11) = Cells(x, y) + Cells(x, y + 1) + Cells(x, y + 2) + Cells(x, y + 3) + Cells(x, y + 4) + Cells(x, y + 5) + Cells(x, y + 6) + Cells(x, y + 7) + Cells(x, y + 8) + Cells(x, y + 9) + Cells(x, y + 10)
C(12) = Cells(x, y) + Cells(x, y + 1) + Cells(x, y + 2) + Cells(x, y + 3) + Cells(x, y + 4) + Cells(x, y + 5) + Cells(x, y + 6) + Cells(x, y + 7) + Cells(x, y + 8) + Cells(x, y + 9) + Cells(x, y + 10) + Cells(x, y + 11)
P = Cells(77, 2)
Cells(Z, R) = C(P)
Z = Z + 1
Next
R = R + 1
S = S + 9
Loop
Code du Combobox
Private Sub CommandButton1_Click()
Cells(77, 2) = ComboBox1.Value
End Sub
Private Sub UserForm_Initialize()
ComboBox1.AddItem "1"
ComboBox1.AddItem "2"
ComboBox1.AddItem "3"
ComboBox1.AddItem "4"
ComboBox1.AddItem "5"
End Sub