Question: how vba works in excel?
Answer:  Create a Macro: With Excel VBA you can automate tasks in Excel by writing so called macros. ... 
 MsgBox: The MsgBox is a dialog box in Excel VBA you can use to inform the users of your program.