VBA code to combine (concatenate) a range of cells

cjcass

Well-known Member
Joined
Oct 27, 2011
Messages
683
Office Version
  1. 2016
Platform
  1. Windows
Hi,
I have the code below which I have used before but it doesn't seem to want to work anymore?
Can anyone see what's wrong with it or suggest an alternative as simple as this to concatenate a range of cells?
many thanks.

Range("AE4").Select
ActiveCell.FormulaR1C1 = "=combine(R5C29:R10000C29)"
Range("AE5").Select
 
Hi,
I don't quite follow you, have changed my code to as below but it has the same problem still...

Code:
For j = 6 To 1000
If Cells(j, 35) = "" Then GoTo 100
myconcat = myconcat & Cells(j, 35)
Next j
100 Cells(1, 35) = myconcat


For j = 6 To 1000
If Cells(j, 38) = "" Then GoTo 1000
myconcat = myconcat & Cells(j, 38)
Next j
1000 Cells(1, 38) = myconcat
 
Upvote 0

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Awesome!
Many thanks for sticking with me on this, much appreciated :)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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