I haven't worked with data arrays in VBA for a while, but thought that it would be a fairly simple procedure to assign values to a one-dimensional array in a single line of code (as opposed to assigning each value in the array separately).
For example, if I wanted an array containing the numbers "one", "two", and "three", I would have expected something like the following to work:
I managed to find someone else with the same problem on another forum (link here), and the accepted solution was more or less exactly what I have above.Code:Dim My_Array(1 To 3) As String My_Array = Array("one", "two", "three")
However, this gives me a compile error "Can't assign to array". Is there a way to achieve what I want to do?
Thanks in advance