0

Is there a way to create an array variable with uniform entries without using a loop? For example, to create an array variable with 25 entries I could do the following:

Dim myarray(1 to 25) as String

For n = 1 to 25
    myarray(n) = "Hello"
Next n

This would get the job done, but I am looking for a way to do that in one fell swoop.

Jeff
  • 23
  • 2
  • 8
  • 1
    You mean: `Dim vArr As Variant: vArr=Array("one", "two", .. "twenty nine"...)` ? – Maciej Los Jun 20 '16 at 15:20
  • Not quite. I'd like it to have all the same value like: `Dim vArr as Variant: vArr=Array("one","one", .. "one"...)` – Jeff Jun 20 '16 at 16:01
  • 2
    Whenever a loop is the most obvious approach it's usually the best approach. If you want to do this multiple times then wrap it up in a function. – Tim Williams Jun 20 '16 at 16:13

0 Answers0