Simple VBA array join not working

The cookie goes to brettdj as resizing a 1D array and populating it is the best way to go (fastest) but I wanted to offer a more lesser-known compact solution in the case that you don’t plan to use this on long arrays. It’s not as fast than the 1D approach, but not slow like concatenation, but it’s convenient when you want to write together fast code (easier not to make typos with one-liners)!

myArray = Range("B2:B10").value
myString = Join(WorksheetFunction.Transpose(myArray), ", ")

or even just:

myString = Join(WorksheetFunction.Transpose(Range("B2:B10").value), ", ")

Leave a Comment