Searches a string for a specified sub-string. If found, any instances of the sub-string are replaced within another string.
Replace ( string, find, replace)
String - (Input, Expression, Required)
Specifies the string to be searched. If a numeric value is passed, it is first converted into a string. If a non-string value is passed, the result is Error. If Null is passed, Null is returned.
Find - (Input, expression, Required)
Specifies the sub-string to search for. If not found, string is returned unchanged. If a numeric value is passed, it is first converted into a string. If Error or Null is passed, the result is Error.
Replace - (Input, expression, Required)
Specifies the string to replace any instances of find that were found. If a numeric value is passed, it is first converted into a string. Null can be passed to effectively delete any instances of find that are found. If Error is passed, the result is Error.
The passed string value with all instances of find replaced with replace, or Error if an error occurred.
Replace (“abcba”, “c”, “xy”) |
Returns “abxyba” |
Replace (“abcba”, “d”, “xy”) |
Returns “abcba” |
Replace (“abcba”, “b”, Null) |
Returns “ aca” |
Replace (“abcba”, Error, Null) |
Returns Error |
Functions are specifically for use in the Macro Editor. Refer to Microsoft's official VB and JScript documentation for scripting equivalents.
Functions | Asc function | Chr function | CSet function | Format function | InStr function | LCase function | Left function | Len function | LSet function | LTrim function | Mid function | Replace function | Right function | RSet function | RTrim function | Space function | String function | TCase function | Trim function | UBound function | UCase function
© 2004-2021 looksoftware. All rights reserved.