Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send keys? 1

Status
Not open for further replies.

faxof

Programmer
Joined
Dec 5, 2001
Messages
272
Location
GB
when in an excel cell i can press alt-enter to add a carriage return to the cell

how do i do that in code?

shold i use send keys or Chr(x)?

quizzed
faxof
 
Well, if you want to insert text into a cell and embed a carriage return, in VBA code, then do something like this...

ActiveCell.FormulaR1C1 = "well" & Chr(10) & " hello"

Hope that's what you mean.

Cheers, Glenn.
 
You can also use the VBA enum "vbLf" (Visual Basic Line Feed) which may or may not be easier to remember than the Chr(10). Either one works great. BlackburnKL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top