ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   force a line break in a comment (https://www.excelbanter.com/excel-programming/284986-force-line-break-comment.html)

Valeria[_2_]

force a line break in a comment
 
Dear experts,
I have a macro that generates cell comments. Since some of
them are quite long, I would like to force a line break.
I tried to use the following:
Msg1 = "No data for this product/ probably it" & vbCrLf
Msg1 = Msg1 & "was not being used yet in this quarter"
Workbooks(Product).Worksheets(1).Cells(i, z).AddComment
Msg1

But what I have in return is a linebreak plus a square
symbol (the one Excel uses when not able to identify a
character).
Can you please help me forcing a line break in my comments?
Many thanks!
Kind regards,
Valeria

Shailesh Shah[_2_]

force a line break in a comment
 
Hi Valeria,

Try vbLF instead of vbCrLf.


Regards,
Shah Shailesh
http://members.lycos.co.uk/shahweb/
(Excel Add-ins)


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Klaus[_4_]

force a line break in a comment
 
At the point you want to insert a line break you have to
insert Chr(10)
Example
Range("F9").Comment.Text Text:="Abcde" & Chr(10)
& "fghijk" & Chr(10) & "lmnop"

Regards
Klaus

-----Original Message-----
Dear experts,
I have a macro that generates cell comments. Since some

of
them are quite long, I would like to force a line break.
I tried to use the following:
Msg1 = "No data for this product/ probably it" & vbCrLf
Msg1 = Msg1 & "was not being used yet in this quarter"
Workbooks(Product).Worksheets(1).Cells(i, z).AddComment
Msg1

But what I have in return is a linebreak plus a square
symbol (the one Excel uses when not able to identify a
character).
Can you please help me forcing a line break in my

comments?
Many thanks!
Kind regards,
Valeria
.



All times are GMT +1. The time now is 04:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com