concatenating of multiple columns with multi rows in VBA macro code

Vasant bangalore

New Member
Joined
May 30, 2023
Messages
2
Office Version
  1. 2013
Platform
  1. Windows
Hi , how can write VB code in macros to get concatenate Country of origin, port of export and port of destination all 3-coulmns in in one column as shown in result column below


Country Of OriginPort
of Export
Port of DestinationResult
INDIANEW DELHISOUTHAMPTONINDIANEW DELHISOUTHAMPTON
INDIACHENNAILONDON GATEWAYINDIACHENNAILONDON GATEWAY
INDIACHENNAILONDON GATEWAYINDIACHENNAILONDON GATEWAY
INDIACHENNAILONDON GATEWAYINDIACHENNAILONDON GATEWAY
INDIACHENNAILONDON GATEWAYINDIACHENNAILONDON GATEWAY
INDIACHENNAILONDON GATEWAYINDIACHENNAILONDON GATEWAY
INDIACHENNAILONDON GATEWAYINDIACHENNAILONDON GATEWAY
INDIACHENNAILONDON GATEWAYINDIACHENNAILONDON GATEWAY
INDIACHENNAILONDON GATEWAYINDIACHENNAILONDON GATEWAY
INDIACHENNAILONDON GATEWAYINDIACHENNAILONDON GATEWAY
INDIACHENNAILONDON GATEWAYINDIACHENNAILONDON GATEWAY
INDIANEW DELHISOUTHAMPTONINDIANEW DELHISOUTHAMPTON
INDIANEW DELHISOUTHAMPTONINDIANEW DELHISOUTHAMPTON
INDIACHENNAILONDON GATEWAYINDIACHENNAILONDON GATEWAY
INDIACHENNAILONDON GATEWAYINDIACHENNAILONDON GATEWAY
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Hi & welcome to MrExcel.
How about
VBA Code:
Sub Vasant()
   With Range("A2", Range("A" & Rows.Count).End(xlUp))
      .Offset(, 4).Value = Evaluate(.Columns(1).Address & "&" & .Columns(2).Address & "&" & .Columns(3).Address)
   End With
End Sub
 
Upvote 0
Solution
Sub Vasant() With Range("A2", Range("A" & Rows.Count).End(xlUp)) .Offset(, 4).Value = Evaluate(.Columns(1).Address & "&" & .Columns(2).Address & "&" & .Columns(3).Address) End With End Sub
thank you its working, great !
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top