Single quote in a textbox disappear when put in cell?

N

NooK

I have a userform in a Excel workbook, this userform basically has
columns, the first 2 are ComboBoxes and the 3rd is textboxes.

I have a save button where I put the value chosen (Or written in th
case of the textbox) of every control in a sheet (One cell for ever
control, cb or tb).

My problem is that quite often users will have to put the text in th
textbox between single quotes (Ex: 'Alex') but when putting the valu
in a cell, the first single quote disappears (Always the first, th
rest is OK).

What I am doing is:

Set SavQ = ActiveSheet.Range("A1")
SavQ.Offset(0, 2).Value = tbSelect1.Value

If I write ex: ''Alex' (2 single quotes in the beggining) in th
textbox then I get the desired value on the cell which would b
'Alex'.

Any ideas to why does this happen? Anyway to overcome it?

Best Regards

Noo
 
B

BrianB

Excel uses the single quote to force data to align to the left cel
border.

Your VB solution will be the same as the manual one. Add another quot
to your user's entry when inserting into the cell
 
N

NooK

Thanks, I solved it by doing exactly what you say, but was wondering i
it was a bug or something else.

Best Regards

Noo
 

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