MsgBox in Excel VBA
The MsgBox is a dialog box in Excel VBA you can use to inform the users of your program. Place a command button on your worksheet and add the following code lines:
1. A simple message.
Result when you click the command button on the sheet:
2. A little more advanced message. First, enter a number into cell A1.
Result when you click the command button on the sheet:
Note: use the & operator to concatenate (join) two strings. Although Range("A1").Value is not a string, it works here.
3. To start a new line in a message, use vbNewLine.
Result when you click the command button on the sheet:
If you're new here, welcome to Excel Easy! Join over 1 million monthly Excel learners. You can find popular courses here: Data Analysis in Excel and Excel VBA.