Tab char in cell

P

Peter Tragardh

Is it possible to insert a tab character into a cell? And if so, I would
like to exchange all strings spelling '\x09' with the tab character. Is
that doable?
 
C

Chip Pearson

Peter,

You can use Chr(9) to get the tab character. E.g.,

Range("A1").Value = "ABC" & Chr(9) & "DEF"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
D

David McRitchie

Is the TAB character within a cell of any use for Excel, or is this
simply to create something for another application ?
 
P

Peter Tragardh

It is for an other application. We import data from one source and
automatically create SQL-commands with it, which we then export to a sql
file. The data source has a tab char originally, but it has transformed to
"\x09" when it reaches the spreadsheet.
 
P

Peter Tragardh

Thanks for the tip, but I have already tried this. It's the tab character
(009) I want, not "'" (039) and it isn't possible to write that character
in the replace field.
 
D

Dave Peterson

I think Dave Hawley may have meant:

Selection.Replace What:="\x09", Replacement:=Chr(9), LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False

After you selected your range of cells to change.
 
J

JE McGimpsey

Dave Hawley said:
Your reply looks exactly the same as mine, including the "What"
argument.

I can't be any clearer than that.

Then AspNNTP (ActionJackson) is either:

a) poorly rendering the \-x-0-9 character sequence (-'s added as
spacers). Inside quotes in a plain text message, it shouldn't actually
escape the \-x. Or

b) poorly rendering the tab character, converting it into an escape
sequence. Again, shouldn't happen in a plain text message within quotes.

To me, what D.H. orginally posted looks like a space character as
opposed to D.P.s escape sequence. *Very* distiguishable.
 

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