Concatenate cells in a Row

mmetzinger

Board Regular
Joined
Dec 30, 2010
Messages
61
I need a way to concatenate cells in a given row.

So let's say we have.

Dim Row as string
Row = Activecell.Row

I need something like
Dim ConValue as string
ConValue = CONCATENATE("A" & Row, "B" & Row)

I know the code above isn't right. I just can't figure out how to give Excel the variable row. I don't want to mess with the whole RC from cursor method.

Thanks,
Matt
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi

Like this:

Code:
Dim ConValue as String
Dim lRow as [COLOR=#ff0000]Long[/COLOR]
lRow = Activecell.Row
ConValue = [COLOR=#ff0000]Range("A" & lRow).Value & Range("B" & lRow).Value[/COLOR]
 
Upvote 0
I need a way to concatenate cells in a given row.

So let's say we have.

Dim Row as string
Row = Activecell.Row

I need something like
Dim ConValue as string
ConValue = CONCATENATE("A" & Row, "B" & Row)

I know the code above isn't right. I just can't figure out how to give Excel the variable row. I don't want to mess with the whole RC from cursor method.
If you only want to concatenate the two cells you show...

Code:
ConValue = Cells(Row, "A").Value & Cells(Row, "B").Value
If, on the other hand, you want to concatenate all the cells from Column A to the last used column on the row...

Code:
Row = 2
Delimiter = ", "
ConValue = Application.Trim(Join(Application.Index(Range(Cells(Row, "A"), Cells(Row, Columns.Count).End(xlToLeft)).Value, 1, 0), Delimiter))
I used a comma/space for the delimiter in the above just to show you how one could be used; however, your stated question showed no delimiter for the concatenation, so you would set that variable equal to "" in order to have nothing between the concatenated cell values.
 
Upvote 0

Forum statistics

Threads
1,223,240
Messages
6,170,951
Members
452,368
Latest member
jayp2104

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