String Concatenation
- Last UpdatedJul 18, 2023
- 1 minute read
To concatenate strings in VBA, use the ampersand ( & ) concatenation operator between the strings. Multiple concatenations can occur in the same VBA statement.
Dim strFirstName As String
Dim strLastName As String
Dim strFullName As String
Const strSpaceChar = " "
' note the space character between the quotes
strFirstName = "Colin"
strLastName = "Ramsden"
strFullName = strFirstName &strSpaceChar &strLastName
' concatenates string values
The & concatenation operator does not perform arithmetic, and will convert variable data types to strings for concatenation. For instance, if a variant string and a variant number are concatenated, the result is a string. For more details of variant data types, see Variant Declaration and VBA Data Types.