![]() |
Carriage return in comment not working
Hi
I am trying to add a comment to a subtotal showing what is included. The macro goes through a loop, adding to the comment string runningmessage = "The following tiers are included in this subtotal:" + vbC runningmessage = runningmessage + subtotmessage(counters) + vbC But after the adding the comment, the data displays horizontally instead of showing the carriage return. This is the code for the comment addition 'Commen Cells(8, checker + 5).AddCommen Cells(8, checker + 5).Comment.Visible = Fals Cells(8, checker + 5).Comment.Shape.TextFrame.AutoSize = Tru Cells(8, checker + 5).Comment.Text Text:=runningmessag Thanks for any help you can give me |
Carriage return in comment not working
Try vbLf?
"dumbass" wrote in message ... Hi- I am trying to add a comment to a subtotal showing what is included. The macro goes through a loop, adding to the comment string: runningmessage = "The following tiers are included in this subtotal:" + vbCr runningmessage = runningmessage + subtotmessage(counters) + vbCr But after the adding the comment, the data displays horizontally instead of showing the carriage return. This is the code for the comment addition: 'Comment Cells(8, checker + 5).AddComment Cells(8, checker + 5).Comment.Visible = False Cells(8, checker + 5).Comment.Shape.TextFrame.AutoSize = True Cells(8, checker + 5).Comment.Text Text:=runningmessage Thanks for any help you can give me! |
Carriage return in comment not working
Hi,
Try replacing the constant vbCR with vbLF Cheers Andy dumbass wrote: Hi- I am trying to add a comment to a subtotal showing what is included. The macro goes through a loop, adding to the comment string: runningmessage = "The following tiers are included in this subtotal:" + vbCr runningmessage = runningmessage + subtotmessage(counters) + vbCr But after the adding the comment, the data displays horizontally instead of showing the carriage return. This is the code for the comment addition: 'Comment Cells(8, checker + 5).AddComment Cells(8, checker + 5).Comment.Visible = False Cells(8, checker + 5).Comment.Shape.TextFrame.AutoSize = True Cells(8, checker + 5).Comment.Text Text:=runningmessage Thanks for any help you can give me! -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
Carriage return in comment not working
Replace "+" with "&"
vbCR with CHR(10) runningmessage = "The following tiers are included in this subtotal:" & CHR(10) runningmessage = runningmessage + subtotmessage(counters) & CHR(10) hth -- steveB (Remove 'NOSPAM' from email address if contacting me direct) "dumbass" wrote in message ... Hi- I am trying to add a comment to a subtotal showing what is included. The macro goes through a loop, adding to the comment string: runningmessage = "The following tiers are included in this subtotal:" + vbCr runningmessage = runningmessage + subtotmessage(counters) + vbCr But after the adding the comment, the data displays horizontally instead of showing the carriage return. This is the code for the comment addition: 'Comment Cells(8, checker + 5).AddComment Cells(8, checker + 5).Comment.Visible = False Cells(8, checker + 5).Comment.Shape.TextFrame.AutoSize = True Cells(8, checker + 5).Comment.Text Text:=runningmessage Thanks for any help you can give me! |
Carriage return in comment not working
Substitute vbCrLf for your vbCr -- you need a linefeed as well as
carriage return. Regards, billy -- Message posted from http://www.ExcelForum.com |
Carriage return in comment not working
Oops, it s/b vbLf, not vbCrLf or vbCr. Also, Chr(10) will do the sam
thing -- Message posted from http://www.ExcelForum.com |
All times are GMT +1. The time now is 01:08 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com