VBA Concatenate Strings in Excel

VBA Concatenate Strings

VBA Concatenate Strings in Excel. We can Append multiple strings into single string by using ‘&’ and ‘+’ operators. All string values are enclosed with double quotation(“”) marks. We have to add space before and after & and + operators. We can append special symbols also.

Syntax to append Strings in Excel VBA

Here is the syntax to concatenate multiple strings using & and + operators in Excel VBA.

Using & Operator

String1 & String2 & ... & StringN

Using + Operator

String1 + String2+...+ StringN

Macro to append Strings using ‘&’ operator in Excel VBA

Let us see the example macro to Concatenate or append Strings using ‘&’ in Excel VBA.

'VBA Append Strings using '&' operator in Excel
Sub VBA_Append_Strings()
    
    'Variable Declaration
    Dim String1 As String, String2 As String, String3 As String
    Dim Result As String
    
    String1 = "Thanks for"
    String2 = " visiting "
    String3 = "our blog."
    
    'Concatenate Strings
    Result = String1 & String2 & String3
    
    MsgBox "Appended Multiple Strings using & operator: " & vbCrLf & Result, vbInformation, "VBAF1"

End Sub

Here is the output screenshot for above macro procedure.

VBA Append Strings

Macro to append Strings using ‘+’ operator in Excel VBA

Let us see the example macro to Concatenate or append Strings using ‘+’ in Excel VBA.

'VBA Concatenate Strings using '+' operator in Excel
Sub VBA_Concatenate_Strings()
    
    'Variable Declaration
    Dim String1 As String, String2 As String, String3 As String
    Dim Result As String
    
    String1 = "22"
    String2 = "44"
    String3 = "66"
    
    'Concatenate Strings
    Result = String1 + ":" + String2 + ":" + String3
    
    MsgBox "Concatenated Multiple Strings using + operator: " & vbCrLf & Result, vbInformation, "VBAF1"

End Sub

Here is the output screenshot for above macro code.

Concatenate Strings

Instructions to Run VBA Macro Code or Procedure:

You can refer the following link for the step by step instructions.

Instructions to run VBA Macro Code

Other Useful Resources:

Click on the following links of the useful resources. These helps to learn and gain more knowledge.

VBA Tutorial VBA Functions List VBA Arrays VBA Text Files VBA Tables

VBA Editor Keyboard Shortcut Keys List VBA Interview Questions & Answers Blog

5 thoughts on “VBA Concatenate Strings in Excel”

Leave a Comment