Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Removal of spaces
I have some code that gets the value from a couple of
combo boxes and strings it together using "&" and then places it in a text box. I want to be able to examine this text, look for any spaces and remove them before placing it in the text box. How can i do this? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Removal of spaces
Neil,
You can use "replace". Please change "a b c" to the variable that you are using. Code: -------------------- replace("a b c"," ","") -------------------- --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Removal of spaces
Use Trim, Rtrim or Ltrim to remove leading and trailing spaces from a text
string eg mystring = " this is some text " remove leading spaces with mynewstring = Ltrim(mystring) remove trailing spaces with mynewstring = Rtrim(mystring) remove both leading and trailing mynewstring = Trim(mystring) Do this before you concatenate your strings with & mynewstring = Trim(string1) & Trim(string2) & Trim(string3) Cheers Nigel "Neil" wrote in message ... I have some code that gets the value from a couple of combo boxes and strings it together using "&" and then places it in a text box. I want to be able to examine this text, look for any spaces and remove them before placing it in the text box. How can i do this? ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =--- |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Removal of spaces
Neil,
Sub testit() Dim strMyValue As String strMyValue = "T h e A b y s s" ComboBox1.AddItem Replace(strMyValue, " ", "") End Sub Rob "Neil" wrote in message ... I have some code that gets the value from a couple of combo boxes and strings it together using "&" and then places it in a text box. I want to be able to examine this text, look for any spaces and remove them before placing it in the text box. How can i do this? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Removal of spaces
Replace was added in Excel 2000, so if you will use the code in an earlier
version sStr = Application.Substitute(sStr," ","") -- Regards, Tom Ogilvy "Neil" wrote in message ... I have some code that gets the value from a couple of combo boxes and strings it together using "&" and then places it in a text box. I want to be able to examine this text, look for any spaces and remove them before placing it in the text box. How can i do this? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Removal of Zero | Excel Worksheet Functions | |||
Password Removal | Excel Discussion (Misc queries) | |||
how do I remove leading spaces and leave the remianing spaces w | Excel Worksheet Functions | |||
spaces not recognized as spaces | Excel Worksheet Functions | |||
Hyperlink Removal | Excel Discussion (Misc queries) |