So i have a vba code that creates an array with multiple elements. I would like to output those elements into one cell in excel. Im able to output its elements to multiple cells but prefer it in one cell. Can this be done?
Asked
Active
Viewed 7,573 times
1 Answers
4
If the array is declared as a String or Variant then you can use Join
:
Sub AllIntoOne()
Dim arr(1 To 3) As Variant
arr(1) = 4
arr(2) = 54
arr(3) = 3
Range("A1") = Join(arr, ",")
End Sub
The delimiter "," defaults to a space if not supplied, but can be an empty string "" if no separation is required.

Andy G
- 19,232
- 5
- 47
- 69
-
Awsome! Thanks for your prompt reponse! – user2734645 Sep 03 '13 at 18:00
-
Yes sir, it worked like a charm! Again, thank you for your response! – user2734645 Sep 03 '13 at 21:37