ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   replace in a string (https://www.excelbanter.com/excel-programming/339729-replace-string.html)

M

replace in a string
 
Hi,

I'm looking for a code which performs the following :
delete a string from another string :
example : tomorrow --- the m should be removed
--- output : toorrow

Thanks



Ron Rosenfeld

replace in a string
 
On Sun, 11 Sep 2005 10:22:56 GMT, "M" wrote:

Hi,

I'm looking for a code which performs the following :
delete a string from another string :
example : tomorrow --- the m should be removed
--- output : toorrow

Thanks


Look at HELP for the SUBSTITUTE worksheet function.

=SUBSTITUTE("tomorrow","m","")

will remove all of the "m"'s.


--ron

Paulw2k

replace in a string
 
Public Sub ReplaceText()
Dim sVal As String

sVal = ActiveCell.Value
sVal = Replace(sVal, "m", "", 1, 1, vbBinaryCompare)
ActiveCell.Value = sVal

End Sub

Note 'vbBinaryCompare' makes it casesensitive


"M" wrote in message
...
Hi,

I'm looking for a code which performs the following :
delete a string from another string :
example : tomorrow --- the m should be removed
--- output : toorrow

Thanks





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

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