Public Cell As Range
Private Sub CommandButton1_Click()
Set Cell = Sheets("données du projet").Range("liste_tranches").Find(Sheets("avenant").Range("tranche_avenant").Value, LookIn:=xlValues, lookat:=xlWhole)
If Cell Is Nothing Then Exit Sub
Call copie
End Sub
Private Sub copie()
Dim Adr As String, Msg As String, Col As Integer
With Sheets("données du projet")
For Col = 7 To 9
If .Cells(Cell.Row, Col) = "" Then Adr = .Cells.Address: Exit For
Next
Select Case Col
Case 7
Msg = "Le montant TTC de l'avenant sera ajouté à la facture"
Case 8
Msg = "Il existe déjà un avenant à ajouter à cette facture, le montant TTC de l'avenant sera ajouté à la facture"
Case 9
Msg = "Il existe déjà deux avenants à ajouter à cette facture, le montant TTC de l'avenant sera ajouté à la facture"
End Select
If Msg = "" Then Exit Sub
MsgBox Msg
.Cells(Cell.Row, Col) = [montant_total_avenant].Value
End With
End Sub