Thread: vbCr
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default vbCr

If it's a Commandbutton on a userform1, at runtime -

CommandButton1.Caption = "First Line" & vbCr & "Second line"

To set at design time probably simplest to copy the two line text from a
cell into the caption property.

If is a commandbutton on a worksheet, in the immediate window (ctrl-g) -

ActiveSheet.oleobjects("CommandButton1").object.ca ption = "first" & vbcr &
"second"

with the cursor at the end of the line hit Enter

Regards,
Peter T


"jimmy" wrote in message ...
Hi,

I tried to use vbCr in the caption property of commandbutton is work but

it
doesn't work in putting contents in a cell, what is the code to get the
result like pressing "Alt + Enter" in a cell?

Thanks