VBA Code to Break a Comment into Multiple Lines

OilEconomist

Active Member
Joined
Dec 26, 2016
Messages
439
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.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
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:
Upvote 0
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!
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,161
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top