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.
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.
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
Hi there! Such a great article, thanks!
Hi there! Such a nice short article, thanks!
Your site has outstanding material. I bookmarked
the site
Hi there! Such a good article, thanks!
I discovered your website from Google and also I need to
claim it was a fantastic locate. Thanks!