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!

Line break within excel cell via code not working

Status
Not open for further replies.

htdenver

Programmer
Joined
Mar 24, 2005
Messages
10
Location
US
Im trying to insert a simple line break via VBA from an access report. Report looks fine but when I export to Excel the cell shows a | istead of putting a line break in. Code to use was simple as follows.

Dcity = Dcity & Chr(13)

MERIDIAN - Showing up as this where Meridian is the city and the line break shows up as a character -
 
You may try this:
Dcity = Dcity & Chr(10)
Or this:
Dcity = Dcity & Chr(13) & Chr(10)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I tried that, did not work either. Thanks for the help though.
 
Hi htdenver,

In Excel, an 'unprocessed' line break should look like a small box in the cell. To get the line break to 'work, you might need to change the cell's alignment, to turn wrapping on.

Other than that, try using vbCr (or perhaps vbCrLf) instead of Chr(10).

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top