Private dlCol As Integer
Private Sub CommandButton1_Click()
Dim a As Integer
With Sheets("ATTRBUTION COC MAN")
a = .Cells(Application.Rows.Count, 9).End(xlUp).Row + 1
.Cells(a, 3).Value = TextBox2.Value 'Article
.Cells(a, 4).Value = TextBox4.Value 'OF
.Cells(a, 5).Value = TextBox5.Value 'Nombre de pièces
.Cells(a, 6).Value = ComboBox2.Value 'Organisme de réception
.Cells(a, 7).Value = TextBox7.Value 'Date
.Cells(a, 8).Value = ComboBox1.Value 'Atelier
.Cells(a, 9).Value = TextBox1.Value 'Nom
.Cells(a, 10).Value = TextBox6.Value 'Commentaires
End With
msg = "À ce jour "
Call dlc("G")
msg = msg & dlCol & ", pour l'article "
Call dlc("C")
msg = msg & dlCol & ", OF "
Call dlc("D")
msg = msg & dlCol & ", pour "
Call dlc("E")
msg = msg & dlCol & " de pièces, la tranche numéro COC sera de "
Call dlc("A")
msg = msg & dlCol
msg = msg & " à "
Call dlc("B")
msg = msg & dlCol & "."
MsgBox msg
Unload Me
End Sub
Sub dlc(col As String)
With Sheets("ATTRBUTION COC MAN")
dlCol = .Cells(Application.Rows.Count, col).End(xlUp).Row
End With
End Sub