ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   userform label set enter (https://www.excelbanter.com/excel-programming/437471-userform-label-set-enter.html)

Alberto Ast[_2_]

userform label set enter
 
I have a userform label set to a specific value copied from two cells.. can I
have an enter betwen both cells value?

Me.Label5 = Range("e12").Value & Range("e13").Value

I would like it to show

ECR
123456

where
ECR is the value in cell c12
123456 is the value in cell e13

it actualy shows
ECR123456

Chip Pearson

userform label set enter
 
Try

Me.Label5 = Range("e12").Value & vbCrLf & Range("e13").Value

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]



On Tue, 15 Dec 2009 12:18:01 -0800, Alberto Ast
wrote:

I have a userform label set to a specific value copied from two cells.. can I
have an enter betwen both cells value?

Me.Label5 = Range("e12").Value & Range("e13").Value

I would like it to show

ECR
123456

where
ECR is the value in cell c12
123456 is the value in cell e13

it actualy shows
ECR123456


Rick Rothstein

userform label set enter
 
Try concatenating vbLf between them...

Me.Label5 = Range("e12").Value & vbLf & Range("e13").Value

--
Rick (MVP - Excel)


"Alberto Ast" wrote in message
...
I have a userform label set to a specific value copied from two cells.. can
I
have an enter betwen both cells value?

Me.Label5 = Range("e12").Value & Range("e13").Value

I would like it to show

ECR
123456

where
ECR is the value in cell c12
123456 is the value in cell e13

it actualy shows
ECR123456



Mike

userform label set enter
 
try this
Me.Label5 = Range("e12").Value & vbcrlf & Range("e13").Value


"Alberto Ast" wrote:

I have a userform label set to a specific value copied from two cells.. can I
have an enter betwen both cells value?

Me.Label5 = Range("e12").Value & Range("e13").Value

I would like it to show

ECR
123456

where
ECR is the value in cell c12
123456 is the value in cell e13

it actualy shows
ECR123456


Peter T

userform label set enter
 
One more way for interest, if the cells are contiguous -

Dim dObj As DataObject
Set dObj = New DataObject
Range("A1:C3").Copy

dObj.GetFromClipboard
Me.Label1 = dObj.GetText(1)
Application.CutCopyMode = False

If only a few cells or non-contiguous stick with what you've got.

Regards,
Peter T



"Alberto Ast" wrote in message
...
I have a userform label set to a specific value copied from two cells.. can
I
have an enter betwen both cells value?

Me.Label5 = Range("e12").Value & Range("e13").Value

I would like it to show

ECR
123456

where
ECR is the value in cell c12
123456 is the value in cell e13

it actualy shows
ECR123456




Alberto Ast[_2_]

userform label set enter
 
Thanks it works great but I have one question...
What is the difference among

vbCr, vbCrLf and vbLf?


"Rick Rothstein" wrote:

Try concatenating vbLf between them...

Me.Label5 = Range("e12").Value & vbLf & Range("e13").Value

--
Rick (MVP - Excel)


"Alberto Ast" wrote in message
...
I have a userform label set to a specific value copied from two cells.. can
I
have an enter betwen both cells value?

Me.Label5 = Range("e12").Value & Range("e13").Value

I would like it to show

ECR
123456

where
ECR is the value in cell c12
123456 is the value in cell e13

it actualy shows
ECR123456


.


Rick Rothstein

userform label set enter
 
I'm not completely sure of your question; see if this answers it. These are
predefined constants in VB... vbCr is a Carriage Return character (ASCII
13), vbLf is a Line Feed character (ASCII 10) and vbCrLf is two
characters... a Carriage Return followed by a Line Feed. You can think of
this last one like this...

vbCrLf <== vbCr & vbLf

Generally, for text files, the vbLf character is used as the "newline"
character in UNIX and Linux operating systems; the vbCr character is used as
the "newline" character in Mac computers and the vbCrLf combination of
characters is used as the "newline" character sequence in Windows systems.
For whatever reason, Microsoft decided to use vbLf for "newlines" in Excel
cell text, MessageBoxes, Labels, etc., contrary to their own established
vbCrLf convention used in Windows text files.

--
Rick (MVP - Excel)


"Alberto Ast" wrote in message
...
Thanks it works great but I have one question...
What is the difference among

vbCr, vbCrLf and vbLf?


"Rick Rothstein" wrote:

Try concatenating vbLf between them...

Me.Label5 = Range("e12").Value & vbLf & Range("e13").Value

--
Rick (MVP - Excel)


"Alberto Ast" wrote in message
...
I have a userform label set to a specific value copied from two cells..
can
I
have an enter betwen both cells value?

Me.Label5 = Range("e12").Value & Range("e13").Value

I would like it to show

ECR
123456

where
ECR is the value in cell c12
123456 is the value in cell e13

it actualy shows
ECR123456


.




All times are GMT +1. The time now is 09:34 AM.

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