Character (13)

  • Thread starter Thread starter Hari
  • Start date Start date
H

Hari

Hi,

I searched in the help for this, but within - chr function - there is
explanation only for Chr(10) being a linefeed character.

I also went to the character set (0-127) but against 13 there are 2 stars.
and the same 2 stars are against chr(10).

Please tell me about the same.
 
Hari

Chr(10) as you point out is Linefeed
Chr(13) is carriage return and linefeed

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 
Back in the days of typewriters, getting to the next line involved two
actions. These were scrolling the feeder and returning the carriage to the
starting position. LineFeed and Carriage Return (LF and CR)
When computers started using typewriters, these commands were still used.
On modern computers, they are still in use as a hangover from these days.

I think that only Microsoft Operating Systems use both LF and CR for a new
line. Others just use LF.
 
Hi Nick and Rob,

Thnx a lot for your answers.

Rob - Thnx a ton for gving the historical perspective. Can appreciate it
better now.
 
There are a couple of constants in xl that you may want to use:

vbLf (line feed)
vbCr (carriage return)
vbNewLine (new line)
VBCrLf (both cr & lf)

When I use msgboxes, I do things like:

msgbox "Hi" & vblf & "hari"

JE McGimpsey (an advocate of cross platform programming (and a typical Mac user
<vbg>) recommends:

msgbox "hi" & vbnewline & "hari"

From the immediate window in the VBE:

?asc(vblf)
10

?asc(vbcr)
13

?len(vbcrlf)
2
?asc(left(vbcrlf,1))
13
?asc(right(vbcrlf,1))
10

?len(vbnewline)
2
?asc(left(vbnewline,1))
13
?asc(right(vbnewline,1))
10

vbNewLine is platform dependent. Under windows, it's 2 characters. Under Mac,
it's just one (IIRC, LF).
 
Hi Dave,

Thnx a lot for instructive explanation using Imm.Window. Came to know about
it 2 days back and like the feature a lot.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top