ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is there a "replace" or "Substitute" command in Excel's VB? (https://www.excelbanter.com/excel-programming/284534-there-replace-substitute-command-excels-vbulletin.html)

[email protected]

Is there a "replace" or "Substitute" command in Excel's VB?
 
Hi,

I was hoping someone could help me with a quick question.

Is there a command something like "substitute" or "replace"?

I basically want a command that will replace all instances of a
particular character with another character... For example, I'd like
to remove all the spaces from the string "hello there world" to make
it "hellothereworld".

Any help would be much appreciated.

Thanks

JohnI in Brisbane

Is there a "replace" or "Substitute" command in Excel's VB?
 
tanast,

try

sString = Replace(sString, " ", "")

regards,

JohnI

wrote in message
...
Hi,

I was hoping someone could help me with a quick question.

Is there a command something like "substitute" or "replace"?

I basically want a command that will replace all instances of a
particular character with another character... For example, I'd like
to remove all the spaces from the string "hello there world" to make
it "hellothereworld".

Any help would be much appreciated.

Thanks




Colo

Is there a "replace" or "Substitute" command in Excel's VB?
 
Hi, you can also use "Substitute" as follows.

sString = "Hello World!"
sString = Application.WorksheetFunction.Substitute(sString, " ", "")

Note:Replace works on Excel 2000 and later version.


--
Kind Regards
Colo
/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Colo of 'The Road of The Cell Masters' :)

URL:http://www.interq.or.jp/sun/puremis/...astersLink.htm


/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/


wrote in message
...
Hi,

I was hoping someone could help me with a quick question.

Is there a command something like "substitute" or "replace"?

I basically want a command that will replace all instances of a
particular character with another character... For example, I'd like
to remove all the spaces from the string "hello there world" to make
it "hellothereworld".

Any help would be much appreciated.

Thanks




All times are GMT +1. The time now is 04:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com