I'll show you how to create a message box popup window in Excel that contains text on multiple lines. This allows you to do the same thing as hitting the "enter" key when writing a message to go to a new line.
The most basic MsgBox code in Excel vba is like this:
Sub test()
MsgBox "Hi! This is a message box"
End Sub
This outputs a simple popup message box window when run.
This macro adds a new line in the message box:
Sub test2()
MsgBox "Hi!" & vbNewLine & "This is a message box"
End Sub
Note the vbNewLine that was added. This is what actually adds the new line to the code. Also, note that you have to use double quotes and an ampersand (&) before you can input the vbNewLine text and then you need to do the same thing again in order to input the rest of the message.
Adding as many lines as needed is really easy. Here is another sample with two new lines, which makes a new blank line appear between the two parts of the message.
Sub test3()
MsgBox "Hi!" & vbNewLine & vbNewLine & "This is a message box"
End Sub
Sub test4()
MsgBox "Hi!" & vbCrLf & vbCrLf & "This is a message box"
End Sub
where CrLf stands for: carriage return line feed.
If your message is a bit wordy, add an underscore ( _ )and you can continue the message on a new line in the code window to reduce the amount of horizonal scrolling to see the complete text of the message.
Sub test5()
MsgBox "Hi!" & vbCrLf & vbCrLf & _
"This is a message box"
End Sub
Choose whichever method you prefer and stick with it - the differences with them are technical and almost never matter, especially with simple message box pop-up windows.