Search notes:

VBA function: replace

replace(str, search, repl) replaces the substring search with repl in the string str.
option explicit

sub replaceTest()

    dim text, text_new as string
    
    text     = "hello bello world"
    text_new = replace(text, "ll", "xyz")
    
    debug.print("text_new = " & text_new)
  ' text_new = hexyzo bexyzo world.
  
end sub
Github repository about-VBA, path: /functions/replace.bas

See also

For more complex search/replace operations, regular expressions might be used.
functions

Index