Thread: Repeat
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] paul.robinson@it-tallaght.ie is offline
external usenet poster
 
Posts: 789
Default Repeat

On Dec 12, 12:45 pm, Mike H. wrote:
In another language I am familiar with if I wanted to express the text
"-----" I could say repeat("-",5). Is there something similar in VBA?


Hi
You could make your own

Public function repeat(inputstring as Variant, repetitions as Long) as
String
Dim temp as String, i as Long
Temp = Cstr(inputstring) 'incase number inputted
For i = 1 to repetitions
temp = temp & inputstring
Next i
repeat = temp
end function

you might need to test unusual inputs.

regards
Paul