WorksheetFunction.Rept Method

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

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

Syntax

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

returnValue = instance.Rept(Arg1, Arg2)
string Rept(
    string Arg1,
    double Arg2
)

Parameters

  • Arg2
    Type: System.Double

    Number_times - a positive number specifying the number of times to repeat text.

Return Value

Type: System.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 #VALUE!.

See Also

Reference

WorksheetFunction Interface

WorksheetFunction Members

Microsoft.Office.Interop.Excel Namespace