DW Faisalabad New Version

DW Faisalabad New Version
Please Jump to New Version

Monday 10 July 2017

MsgBox

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: we used 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:

.