Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
vbCr
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
vbCr
Try something like this for cells. I just picked H1 because it was handy:
Range("H1").NumberFormat = "@" ' set to text format Range("H1") = "Hello" & vbLf & "goodbye." 'use vbLf vs vbCr or vbCrLf Range("H1").WrapText = True ' hides the little square box "jimmy" wrote: 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
if AddIn_1 isRunning vbcr application.enableEvents=False vbcr end if: how to do this?? | Excel Programming | |||
Having trouble with "vbcr" | Excel Programming | |||
vblf and vbcr one last question | Excel Programming | |||
Supressing CHR13 or vbCr write in text file | Excel Programming |