xxxxxxxxxx
Sub MessageBoxExample()
Dim result As Integer
result = MsgBox("Do you want to continue?", vbYesNo, "Confirmation")
If result = vbYes Then
' Code to execute if Yes button is clicked
Else
' Code to execute if No button is clicked
End If
End Sub
xxxxxxxxxx
Dim answer As Integer
answer = MsgBox("Text", vbQuestion + vbYesNo + vbDefaultButton2, "Message Box Title")
If answer = vbYes Then
MsgBox "Yes"
Else
MsgBox "No"
End If
xxxxxxxxxx
Sub effacerB2()
If MsgBox("Etes-vous certain de vouloir supprimer le contenu de B2 ?", vbYesNo, "Demande de confirmation") = vbYes Then
Range("B2").ClearContents
MsgBox "Le contenu de B2 a été effacé !"
End If
End Sub