VBA Code to Break a Comment into Multiple Lines

OilEconomist

Board Regular
Joined
Dec 26, 2016
Messages
194
Office Version
  1. 2019
Platform
  1. Windows
Thanks in advance for any solutions, suggestions or help for which I will give feedback.

I have two questions which are similar, but not exactly the same:

(1) How do you break a comment such as the following into multiple lines (i.e. continuation)? This is basically so I can keep it on the screen without having to scroll over to read it. When I try to do the following it gives errors.


Code:
MsgBox "There is an error when I try to break this comment _ 
into multiple lines like I'm doing now. Can anyone suggest _ 
how to fix this.

(2) Besides breaking the comment into multiple lines, how do you do that and show hard returns in an excel box, to where the box will show something like this....I assuming it's possibly a form box?

The following errors occurred:
(1) Incorrect path.
(2) Incorrect file name.
 

Some videos you may like

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,770
Office Version
  1. 2010
Platform
  1. Windows
Code:
  MsgBox "There is an error when I try to break this comment " & _
         "into multiple lines like I'm doing now. Can anyone suggest " & _
         "how to fix this."

  MsgBox "The following errors occurred:" & vbLf & _
         "(1) Incorrect path." & vbLf & _
         "(2) Incorrect file name."
 
Last edited:

OilEconomist

Board Regular
Joined
Dec 26, 2016
Messages
194
Office Version
  1. 2019
Platform
  1. Windows
shg that worked perfectly! I could not find the first solution anywhere for comments. Other items, but not for comments.

The second answer I found nowhere! Thanks my friend from the Lone Star State!
 

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,770
Office Version
  1. 2010
Platform
  1. Windows
You're welcome.
 

SpillerBD

Well-known Member
Joined
Jul 2, 2014
Messages
2,707
Thanks in advance for any solutions, suggestions or help for which I will give feedback.

I have two questions which are similar, but not exactly the same:

(1) How do you break a comment such as the following into multiple lines (i.e. continuation)? This is basically so I can keep it on the screen without having to scroll over to read it. When I try to do the following it gives errors.


Code:
MsgBox "There is an error when I try to break this comment _ 
into multiple lines like I'm doing now. Can anyone suggest _ 
how to fix this.

(2) Besides breaking the comment into multiple lines, how do you do that and show hard returns in an excel box, to where the box will show something like this....I assuming it's possibly a form box?

The following errors occurred:
(1) Incorrect path.
(2) Incorrect file name.

During entry in a Cell, use ALT+ENTER to create the LF
In a Comment Box use SHIFT+ENTER to create you LF.
 

Watch MrExcel Video

Forum statistics

Threads
1,108,951
Messages
5,525,846
Members
409,667
Latest member
jwieting

This Week's Hot Topics

Top