Testing for the end of a cell character

E

EEvans

I would like to know how to detect/check for the end of cell marker in a
table. I have a macro that needs to detect that character to stop. I have
tried vbCr, vbCrLf, etc... What is that character or is there a ASCII value
that I can use?

Thanks,

Eric
 
J

Jezebel

chr(7)

For future reference, you can investigate using the ASC() function, eg

For i = 1 to len(Text)
debug.print asc(mid(text,i,1))
Next
 
T

Tony Jollans

This does depend on whether you are looking at Word 'Characters', in which
case the end of cell is a Range, length 2, chr(13) and chr(7), or looking at
the Text string, in which case the last two characters (with a small c) will
be chr(13) and chr(7).

If you are checking the value of the characters rather than the position
within the cell then the former is the correct method - the latter can
occasionally give the wrong result (in unusual circumstances, I'll grant).
 
H

Helmut Weber

Hi EEvans,

what does it mean:
detect/check for the end of cell marker

The end-of-cell-mark consists of chr(13) & chr(7).

If the insertion point is right before the end-of-cell-mark
Len(Selection.Text) returns 2.

Asc(Right(Selection.Text, 1)) returns 7.
 

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

Top