VBA code to concate a range and have a ; as the divider between the values

drop05

Active Member
Joined
Mar 23, 2021
Messages
285
Office Version
  1. 365
Platform
  1. Windows
I am trying to concatenate values from a range in column A from row 1 to row 81 with a "; " to be between each value in the concat, i am not sure how t to get it done in an easier way than

"=CONCATENATE(RC[-1],""; "",R[1]C[-1],""; "")"
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Could you give us a small set of sample dummy data and the expected results with XL2BB?
That way we get a better idea of what you have, where it is, as well as what you want and where that is.
Say rows 1:10 instead of 1:81.
 
Upvote 0
Upvote 0
If you do, try ..

VBA Code:
Sub myConcat()
  Range("B1").Value = Join(Application.Transpose(Range("A1:A10").Value), "; ")
End Sub
i wasnt sure the formual rather than clicking each cell for the range but if i can use a range like A1:A10 and have the "; " there that would be way easier yes
 
Upvote 0
An option available to you is Power Query.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Transposed Table" = Table.Transpose(Source),
    #"Merged Columns" = Table.CombineColumns(#"Transposed Table",{"Column1", "Column2", "Column3", "Column4", "Column5", "Column6", "Column7", "Column8", "Column9", "Column10"},Combiner.CombineTextByDelimiter("; ", QuoteStyle.None),"Merged")
in
    #"Merged Columns"
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,178
Members
448,871
Latest member
hengshankouniuniu

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