Friday, 16 January 2015

Using The message Box with if exlse


Private Sub Msg_Click()

 

Dim answer As Integer

answer = MsgBox("Are you sure you want to empty the sheet?", vbYesNo + vbQuestion, "Empty Sheet")

 

If answer = vbYes Then

    Cells.ClearContents

Else

    exit sub

End If

 

End Sub

No comments:

Post a Comment