Line break code in VBA Excel

Solved
lecrol Posted messages 224 Registration date   Status Membre Last intervention   -  
 arianinou -
Hello,

I am editing labels in Excel VBA; For each label, I always have 2 lines or almost, depending on the length of the label I print and the product code that comes immediately after.

I would like to be able to "force" the line break, so that it always happens at the same place in my string. But I don't know what code I need to put for that in my string.

Who knows the solution to this problem?
Thank you very much in advance.
Roland
Example: I want to print on my label "product machine thing B02465"

But I want to get it all on two lines
"product machine thing"
"B02465"

Of course, my Excel line is set to "wrap text automatically"

Configuration: Windows XP / Internet Explorer 8.0

15 réponses

Mike-31 Posted messages 18405 Registration date   Status Contributeur Last intervention   5 145
 
Hi,

for example, if you want to write "hello" on one line and "who is this" on the next line in A2
[A2] = "hello" & vbCrLf & "who is this"

--
Best regards,
Mike-31

A period of failure is an ideal time to sow the seeds of knowledge.
31
Nouamane94 Posted messages 3 Status Membre
 
Thank you Mike :)
0