Bonsoir à tous

Voila je suis face à un petit soucis de combinaison en effet je voudrai appliquer les mêmes procédures de la macro ci-dessous (qui fonctionne parfaitement en feuille1) dans la feuille2 en cliquant sur le même bouton nommé CommandButton1_Click

Voici la macro :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
Private Sub CommandButton1_Click()
Dim Ctrl As Control
Dim r As Integer
Dim Derligne As Integer
Dim LigneDebut As Long
Dim x As Integer, L As Integer, nombre_de_colonne As Integer
Dim Ligne As Long, Celluledebut As Integer, Cellulefin As Integer
 
With Worksheets("feuil1")
LigneDebut = 12
Derligne = .Range("A" & Cells.Rows.Count).End(xlUp).Row + 1
Ligne = Derligne
Celluledebut = 3: Cellulefin = 7
Range(Cells(Ligne, Celluledebut), Cells(Ligne, Cellulefin)).Merge
For Each Ctrl In UserForm1.Controls
r = Val(Ctrl.Tag)
If r > 0 Then Feuil1.Cells(Derligne, r) = Ctrl
nombre_de_colonne = 2
  For x = 2 To nombre_de_colonne
    L = Cells(Rows.Count, 1).End(xlUp).Row
    Cells(L + 1, x).Formula = "=SUM(" & Cells(12, x).Address & ":" & Cells(L, x).Address & ")"
             Next
         Next
   End With
   TextBox1 = ""
   Unload Me
End Sub
Merci par avance

Cordialement