Lesson#71: Add a button to the worksheet and show a message box on click
Now you will know how to add a button to the worksheet and show a message box on click.
1. Go to Developer Tab.
2. Click on Insert.
3. Select Button (Form Control).
4. Put the button on the worksheet by dragging and putting it on the sheet.
5. Immediately Macro name window will appear.
6. Click on New.
7. There you have to put this Code.
Sub Button2_Click()
MsgBox (“Your Message”)
End Sub
MsgBox (“Your Message”)
End Sub
8. Click on Run Sub/ UserForm.
9. Click on the Run in the Macros window.
Your Message box will be visible like it has shown in the picture left.
Leave a Reply