WorksheetFunction.Rept (Excel)

Repeats text a given number of times. Use Rept to fill a cell with a number of instances of a text string.

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.

Rept (Arg1, Arg2)


Dim strArg1 As String: strArg1 = 
Dim dblArg2 As Double: dblArg2 = 
Dim strRept As String
strRept = WorksheetFunction.Rept(Arg1:=strArg1, Arg2:=dblArg2)

Arguments

Arg1, Arg2

Arg1 (String) - Text - the text that you want to repeat.

Arg2 (Double) - Number_times - a positive number specifying the number of times to repeat text.