EXCEL VBA MACROS EXERCISES▼
Excel VBA Macros | Messages and variables exercise | Using MSGBOX to ask whether to show answer
This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.
You can learn how to do this exercise if you attend one of more of the courses listed below!
You need a minimum screen resolution of about 700 pixels width to see our exercises. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.
Create a new workbook, and type 42 into cell A1 and press Enter. This is the answer.
Select a different cell on a different sheet.
Create a macro which will take you to the answer IF you want to see it. Your macro should first create a variable and then use the MsgBox function to ask whether you want to see the answer:
Note that by default we have made sure that the second (NO) button is the one selected
You will probably find the courseware manual section on the MsgBox function useful for this exercise.
Your macro should now select the answer on the correct worksheet if your user chooses Yes, or display the following message otherwise:
This is included just so something happens in either eventuality
Save this workbook as Example of Continue Question, then close it down.