Option Explicit
Sub RepeatString()
Dim Mystr As String, OutPutStr1 As String, OutPutStr2 As String, OutPutStr3 As String
Dim i As Long, v As Long
Mystr = " KB article XX "
i = 10
OutPutStr1 = Application.WorksheetFunction.Rept(Mystr, i)
Debug.Print "REPT Function " & vbNewLine & OutPutStr1
OutPutStr2 = Replace(Space(i), " ", Mystr)
Debug.Print "Space and Replace " & vbNewLine & OutPutStr2
For v = 1 To i
OutPutStr3 = OutPutStr3 & Mystr
Next v
Debug.Print "The ugly FOR loop " & vbNewLine & OutPutStr3
End Sub
|