Bonjour,

Je voudrais ajouter un Msgbox à la commande CmdButtonENREGISTRER_Click afin de décider si oui l'enregistrement doit s'exécuter

ou non pour ne pas le faire.

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
Private Sub CmdButtonENREGISTRER_Click() ' Enregistrer
 
    If Me.TextBoxInsererMontant = "" Then
        MsgBox "Vous n'avez pas renseigné le montant a Partager", vbInformation, "Saisie manquante"
        Me.TextBoxInsererMontant.SetFocus
        Exit Sub
    End If
    If Me.TextBoxDATE_Enregistree Like "##/##/####" And IsDate(TextBoxDATE_Enregistree.Value) Then
        Worksheets("PARTAGE GLOBAL").Range("G5").Value = CDbl(TextBoxInsererMontant.Value)        ''  << ici
        Worksheets("PARTAGE GLOBAL").Range("G4").Value = CDate(TextBoxDATE_Enregistree.Value)     ''  << ici
    Else
 
        MsgBox "Attention, saisissez une date de réception en respectant le format JJ/MM/AAAA.", vbExclamation, "Saisie manquante"
        TextBoxDATE_Enregistree.SetFocus
        Exit Sub
 
        '__________________________________________________________________________
        With ThisWorkbook.Worksheets("PARTAGE GLOBAL").Range("G5")
            .Value = TextBoxInsererMontant.Value
            .NumberFormat = "#,##0"
        End With
    End If
    '__________________________________________________________________________
 
    CmdButtonFERMER_Click
End Sub
Avec cet exemple:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
Sub MsgBoxVariable()
 
Dim réponse As Integer
réponse = MsgBox("Voulez-vous continuer?", vbQuestion + vbYesNo)
 
  If réponse = vbYes Then
    MsgBox "Oui"
  Else
    MsgBox "Non"
  End If
 
End Sub
Cordialement.