WorksheetFunction.Rept method (Excel)
Repeats text a given number of times. Use Rept to fill a cell with a number of instances of a text string.
Syntax
expression.Rept (Arg1, Arg2)
expression A variable that represents a WorksheetFunction object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Arg1 | Required | String | Text - the text that you want to repeat. |
Arg2 | Required | Double | Number_times - a positive number specifying the number of times to repeat text. |
Return value
String
Remarks
If number_times is 0 (zero), Rept returns "" (empty text).
If number_times is not an integer, it is truncated.
The result of the Rept function cannot be longer than 32,767 characters, or Rept returns the #VALUE! error value.
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.