ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   populating a cell with text w/ line breaks (https://www.excelbanter.com/excel-programming/303585-re-populating-cell-text-w-line-breaks.html)

Nick Hodge

populating a cell with text w/ line breaks
 
Joe

In XL2003 this worked

Sub test()
ActiveCell.Value = "Ben" & Chr(10) & "Hur" & Chr(10) & "Gladiator"
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Joe" wrote in message
...
I am using XL 2002. I need to populate cells with data that has been

created using the vbcrlf constant (i.e. data value = "Ben" & vbcrlf & "Hur"
& vbcrlf & "gladiator").

When I populate the cell with the data value above it appears double

spaced, like this:

Ben

Hur

gladiator

I want it to apepar like this:

Ben
Hur
gladiator

What is the vb constant used to create the Alt+Enter line break while

populating a cell?

TIA,
--
Joe

VBA Automation/VB/C++/Web and DB development




SidBord

populating a cell with text w/ line breaks
 
I have always used "vbCR" instead of "vbCRLF". Does the
"vbCRLF" add an additional line feed??
-----Original Message-----
Joe

In XL2003 this worked

Sub test()
ActiveCell.Value = "Ben" & Chr(10) & "Hur" & Chr(10) &

"Gladiator"
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England



"Joe" wrote in message
...
I am using XL 2002. I need to populate cells with data

that has been
created using the vbcrlf constant (i.e. data value = "Ben"

& vbcrlf & "Hur"
& vbcrlf & "gladiator").

When I populate the cell with the data value above it

appears double
spaced, like this:

Ben

Hur

gladiator

I want it to apepar like this:

Ben
Hur
gladiator

What is the vb constant used to create the Alt+Enter

line break while
populating a cell?

TIA,
--
Joe

VBA Automation/VB/C++/Web and DB development



.


Norman Jones

populating a cell with text w/ line breaks
 
Hi SidBoard,

From Help:

vbCrLf Chr(13) + Chr(10) Carriage return-linefeed combination

vbCr Chr(13) Carriage return character
vbLf Chr(10) Linefeed character
vbNewLine Chr(13) + Chr(10)


---
Regards,
Norman

"SidBord" wrote in message
...
I have always used "vbCR" instead of "vbCRLF". Does the
"vbCRLF" add an additional line feed??
-----Original Message-----
Joe

In XL2003 this worked

Sub test()
ActiveCell.Value = "Ben" & Chr(10) & "Hur" & Chr(10) &

"Gladiator"
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England



"Joe" wrote in message
...
I am using XL 2002. I need to populate cells with data

that has been
created using the vbcrlf constant (i.e. data value = "Ben"

& vbcrlf & "Hur"
& vbcrlf & "gladiator").

When I populate the cell with the data value above it

appears double
spaced, like this:

Ben

Hur

gladiator

I want it to apepar like this:

Ben
Hur
gladiator

What is the vb constant used to create the Alt+Enter

line break while
populating a cell?

TIA,
--
Joe

VBA Automation/VB/C++/Web and DB development



.





All times are GMT +1. The time now is 06:56 PM.

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