'?' displayed in excel: when I hit enter for a new line in textbox

S

sam

I have a textbox which accepts large amout of text. So I set the
'EnterKeyBehaviour' property to True, as users can hit enter for a new line.

Once I Set EnterKeyBehaviour property to True, The cell in excel where this
textbox value is stored displays a '?' where ever I hit enter.

For eg:
If in userform text box I entered:
one two three four
five six seven

the excel output displays:
one two three four?
five six seven?

These question marks are displayed where ever I hit enter for a new line in
the textbox.

I hope I made it clear

Thanks in advance
 
J

john

sounds like you are showing the carriage return.

Try this approach and see if solves problem:

Range("A1").Value = Application.Substitute(TextBox1, Chr(13), "")
 
D

Dave Peterson

That enter key is two characters line feed and carriage control.

So fix the string before you plop the value into the cell.

Worksheets("sheet9999").range("A1").value _
application.replace(me.textbox, vbcr, "")

The linefeeds are the alt-0101 (char(10)'s) and you'll want to keep them.
 
S

sam

Thans a lot john, This worked out great

john said:
sounds like you are showing the carriage return.

Try this approach and see if solves problem:

Range("A1").Value = Application.Substitute(TextBox1, Chr(13), "")
 
D

Dave Peterson

There are a bunch of typos in this message:

Worksheets("sheet9999").range("A1").value _
= replace(me.textbox1.value, vbcr, "")

The linefeeds are the alt-0010 (char(10)'s) and you'll want to keep them.

If you're using or supporting xl97, you can use:

Worksheets("sheet9999").range("A1").value _
= application.substitute(me.textbox1.value, vbcr, "")
 

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