Option Explicit
Sub AjouterGuide()
With ActiveSheet
If .Name <> "Guides" Then Exit Sub
If [L12] = "" Or [L15] = "" Or [L18] = "" Or [L21] = "" Or _
[L24] = "" Or Val(Replace$([L27], ",", ".")) = 0 Then
MsgBox "Le formulaire n'est pas complet.": Exit Sub
End If
Dim lig&: Application.ScreenUpdating = 0: .Unprotect
With .ListObjects("Table54")
If .DataBodyRange Is Nothing Then lig = 2 _
Else .ListRows.Add: lig = .ListRows.Count + 1
End With
End With
With Cells(lig, 2)
.Value = "Guide" 'Type
.Offset(, 1) = [L12] 'Pays
.Offset(, 2) = [L15] 'Ville
.Offset(, 3) = [L18] 'Nom
.Offset(, 4) = [L21] 'Prestataire
.Offset(, 5) = [L24] 'Durée
.Offset(, 6) = [L27] 'Prix
With .Offset(, 8)
.NumberFormat = "dd/mm/yy hh:mm"
.Value = Now 'Date et h d'ajout
End With
End With
ActiveSheet.Protect
End Sub