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
| Sub Valider()
Set fr = Sheets("RECAP CONTRAT")
Call VerifDesSaisies
If flag = 1 Then Exit Sub
'Report sur la feuille RECAP CONTRAT
lgn = fr.Range("A" & Rows.Count).End(xlUp)(2).Row
For i = 1 To 15
adSource = Choose(i, "B3", "B7", "B9", "B13", "F11", "B11", "F16", "D11", "B16", "D16", "I16", "C34", "C37", "H11", "I3")
adDest = Choose(i, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 23, 25)
fr.Cells(lgn, adDest) = Range(adSource)
Next i
'modification de l'action affecté au bouton
ActiveSheet.Shapes("Button 1").OnAction = "modifier"
'suite de ta macro
ActiveSheet.Name = Format(Range("B3"), "00") & "-" & Range("B7")
fr.Range("A" & lgn) = Range("B3")
MsgBox "Le contrat n°" & Format(Range("B3"), "00") & " est enregistré"
Sheets("RECAP CONTRAT").Activate
End Sub |