Okay guys, so now we're going to see how to add a new line. So I still have two sentences written into separate lines. So let's say we want to write these two sentences here, jack loves pizza, and Joe loves chocolate. We want to write these in two separate lines, maybe inside a message box or in any other application in VBA. So we're gonna have messagebox jack loves pizza, and then and then we're gonna put an ampersand a space and then an ampersand and the space is really important. And then VB new line, and then a space and then an ampersand and then Joe loves chocolate.
Okay, so this way, we will have these two sentences written into separate lines. So if you run the code here, you can have jack close pizza and then in a new line, Joe loves chocolate. And it's very important to put a space between the different elements here. So if you don't put a space and Click away, you can see here that you get an error. Okay, so you need to make sure that you put a space between the VB newline and the ampersand. And the second statement statement is going to go on the second line here.
And the same goes for the statement on the first line as well. And the VB new line is a constant, and it is used to separate elements in different lines. And you can also use VB CR lF and this stands for Visual Basic carriage return line feed. And this is a bit of an older statement. So this is the new modern one VB new line and I personally prefer this one because it's easier to remember, its name is intuitive, it's easy to remember. So this is how you can put different statements in separate lines in Excel VBA and you can use this in any excel vba application where you need to deal with strings basically.
Okay, so thanks for watching. I'll see you on the next one.