Replace replaces one string with another: : String Replace « String Functions « VBA / Excel / Access / Word






Replace replaces one string with another:

 
Sub ReplaceExample()
    Debug.Print Replace("Say Hello if you want to", "hello", "bye")
    'Returns Say bye if you want to
    Debug.Print Replace("This gets rid of all of the spaces", " ", "")
    'Returns Thisgetsridofallofthespaces
End Sub

 








Related examples in the same category