Carriage return in comment not working

G

Guest

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
 
B

Bob Kilmer

Try vbLf?

dumbass said:
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:
 
S

steveB

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 said:
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:
 
B

billyb

Substitute vbCrLf for your vbCr -- you need a linefeed as well as
carriage return.

Regards,
billy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top