Rediger

Del via


WorksheetFunction.ReplaceB method (Excel)

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

Syntax

expression.ReplaceB (Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a WorksheetFunction object.

Parameters

Name Required/Optional Data type Description
Arg1 Required String Old_text - text in which you want to replace some characters.
Arg2 Required Double Start_num - the position of the character in old_text that you want to replace with new_text.
Arg3 Required Double Num_chars - the number of characters in old_text that you want Replace to replace with new_text.
Arg4 Required String New_text - the text that will replace characters in old_text.

Return value

String

Remarks

Replace is intended for use with languages that use the single-byte character set (SBCS), whereas ReplaceB is intended for use with languages that use the double-byte character set (DBCS). The default language setting on your computer affects the return value in the following way:

  • Replace always counts each character, whether single-byte or double-byte, as 1, no matter what the default language setting is.

  • ReplaceB counts each double-byte character as 2 when you have enabled the editing of a language that supports DBCS, and then sets it as the default language. Otherwise, ReplaceB counts each character as 1.

  • The languages that support DBCS include Japanese, Chinese (Simplified), Chinese (Traditional), and Korean.

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.