VBA JOIN Function

HomeVBA Functions LIST (Category Wise)How to use the VBA JOIN Function (Syntax + Example)

What is VBA JOIN Function

how to use it

To use VBA's JOIN function you need to understand its syntax and arguments:


Join(SourceArray, [Delimiter])


  • SourceArray: An array of values that you want to join as a new string.
  • [Delimiter]: A delimiter that you want to use to separate each of the substrings when making up the new string.

Example to use JOIN Function in VBA

To practically understand how to use VBA JOIN function, you need to go through the below example where we have written a vba code by using it:

Sub example_JOIN()
Dim myAry(0 To 4) As String
myAry(0) = Range("A1")
myAry(1) = Range("A2")
myAry(2) = Range("A3")
myAry(3) = Range("A4")
myAry(4) = Range("A5")
Range("A7").Value = Join(myAry)
End Sub

In the above code, we have used JOIN value from an array (myAry) which takes all the values from the cell ranges which we have defined and it has returned the new string in the cell A1.


Below are some important points which you need to take care while using JOIN function in VBA.

  • Join function doesn’t work if the array is declared as date data type or variant data type.

Related Functions

About the Author

puneet one point one

Puneet is using Excel since his college days. He helped thousands of people to understand the power of the spreadsheets and learn Microsoft Excel. You can find him online, tweeting about Excel, on a running track, or sometimes hiking up a mountain.