How to Join words (concatenate) using Microsoft Excel VBA.

To concatenate multiple strings into a single string in Microsoft Excel, you can use the & operator to separate the string values.Joining two words concatenate(joining) using & in Excel VB .




Example: 1


Option Explicit

Sub datamanuplate()

Dim txt1 As String

Dim txt2 As String

Dim txt3 As String

Dim txt4 As String

txt1 = "hellow"

txt2 = "How"

txt3 = "are you"

txt4 = "Doing"

MsgBox txt1 & " " & txt2 & " " & txt3 & " " & txt4

End Sub

Add above code in Excel VB Place Command Button and see.
Out Put
......



Example 2

Ok now Lets see how Example 1 works in Excel cells that Contain same words.

Follow the Steps in Example 1 and Check this below code in Excel VBA.

Option Explicit

Sub datamanuplate()

Dim txt1 As String

Dim txt2 As String

Dim txt3 As String

Dim txt4 As String

txt1 = Range("a1").Value

txt2 = Range("b1").Value

txt3 = Range("c1").Value

txt4 = Range("d1").Value

Range("f1").Value = txt1 & " " & txt2 & " " & txt3 & " " & txt4

End Sub


Out Put




Note: Using & " "& Joining the words and using this " " for give space.


Do you like this page..?? Please Give your Email Id subscribe below for Daily News letter..Or Like Facebook Page..!!!


How to Join words (concatenate) using Microsoft Excel VBA. How to Join words (concatenate) using Microsoft Excel VBA. Reviewed by Unknown on 22:37 Rating: 5

No comments:

Powered by Blogger.