WorksheetFunction.Replace Method

Replaces part of a text string, based on the number of characters you specify, with a different text string.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
Function Replace ( _
    Arg1 As String, _
    Arg2 As Double, _
    Arg3 As Double, _
    Arg4 As String _
) As String
'Usage
Dim instance As WorksheetFunction
Dim Arg1 As String
Dim Arg2 As Double
Dim Arg3 As Double
Dim Arg4 As String
Dim returnValue As String

returnValue = instance.Replace(Arg1, Arg2, _
    Arg3, Arg4)
string Replace(
    string Arg1,
    double Arg2,
    double Arg3,
    string Arg4
)

Parameters

  • Arg1
    Type: System.String

    Text in which you want to replace some characters.

  • Arg2
    Type: System.Double

    The position of the character in Arg1 that you want to replace with Arg4.

  • Arg3
    Type: System.Double

    The number of characters in Arg1 that you want the Replace(String, Double, Double, String) method to replace with Arg4.

  • Arg4
    Type: System.String

    Text that will replace characters in Arg1.

Return Value

Type: System.String

See Also

Reference

WorksheetFunction Interface

WorksheetFunction Members

Microsoft.Office.Interop.Excel Namespace