SpreadsheetGear 2012
Replace Method (IRange)






Specifies the text to to find.
Specifies the replacement text.
Specifies partial or complete match.
Specifies whether to search by rows or by columns.
Specifies whether text searches should match case.
Attempts to replace the specified text according to the specified options, returning the number of replacements if successful or zero if not successful.
Syntax
'Declaration
 
Function Replace( _
   ByVal what As System.String, _
   ByVal replacement As System.String, _
   ByVal lookAt As LookAt, _
   ByVal searchOrder As SearchOrder, _
   ByVal matchCase As System.Boolean _
) As System.Integer
'Usage
 
Dim instance As IRange
Dim what As System.String
Dim replacement As System.String
Dim lookAt As LookAt
Dim searchOrder As SearchOrder
Dim matchCase As System.Boolean
Dim value As System.Integer
 
value = instance.Replace(what, replacement, lookAt, searchOrder, matchCase)
System.int Replace( 
   System.string what,
   System.string replacement,
   LookAt lookAt,
   SearchOrder searchOrder,
   System.bool matchCase
)
function Replace( 
    what: System.String;
    replacement: System.String;
    lookAt: LookAt;
    searchOrder: SearchOrder;
    matchCase: System.Boolean
): System.Integer; 
function Replace( 
   what : System.String,
   replacement : System.String,
   lookAt : LookAt,
   searchOrder : SearchOrder,
   matchCase : System.boolean
) : System.int;
System.int Replace( 
   System.string* what,
   System.string* replacement,
   LookAt lookAt,
   SearchOrder searchOrder,
   System.bool matchCase
) 
System.int Replace( 
   System.String^ what,
   System.String^ replacement,
   LookAt lookAt,
   SearchOrder searchOrder,
   System.bool matchCase
) 

Parameters

what
Specifies the text to to find.
replacement
Specifies the replacement text.
lookAt
Specifies partial or complete match.
searchOrder
Specifies whether to search by rows or by columns.
matchCase
Specifies whether text searches should match case.

Return Value

Returns the number of replacements if successful or zero if not successful.
Remarks
Locked cells in a protected worksheet will be ignored. Array formulas will be ignored in cells other than the top-left cell of the array formula range. Replacing the formula in the top-left cell of the array formula range will modify all formulas in the array formula range.
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

IRange Interface
IRange Members
Find Method
LookAt Enumeration
SearchOrder Enumeration

Send Feedback