Remove spaces

  • Thread starter Thread starter Soniya
  • Start date Start date
S

Soniya

Hi All,

How could I remove all spaces from a text?

I have a userform with a text box. when the user input
some text there I want to get that text in to my sheet1
A1 removeing all spaes.

for eg. if the text is "This is my text" then A1 should
get "thisismytext"

any help?

TIA

Soniya
 
Try this...

Private Sub CommandButton1_Click()
Range("A1").Value = Replace(TextBox1.Text, " ", "")
End Sub
 
Replace works for xl2000 onward, for all versions

Range("A1").Value = Application.Substitute(Textbox1.Text," ","")
 

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