Concantate formatting issue

JonRowland

Active Member
Joined
May 9, 2003
Messages
416
Office Version
  1. 365
Platform
  1. Windows
Hi,

I am looking to bascially concantate cells from Cols C&D, separtgin the values with a comma. All seems easy but when the result is returned there values appear not has I would like.

For example
C: 123456
D: 654321
I would like combinated as 123456,654321 but end up with 123,456,654,321 and if look in cells the data is stored as 123456654321.

I've tried lots of different ways but code I with at the moment is

VBA Code:
Sub ConcatCells()

    Dim Row As Long
    Dim LastRow As Long
    Dim RC As Long

    LastRow = Application.WorksheetFunction.CountA(Range("A:A"))

    For Row = 2 To LastRow

        Cells(Row, 5) = Join(Application.Transpose(Application.Transpose(Range(Cells(Row, 3), Cells(Row, 4)))), ",")

    Next Row
End Sub

I could use Cells(2, 3).FormulaR1C1 = "=CONCATENATE(RC[1],"","",RC[2])" which works but then need to Copy & Paste as values which needs calucation turned back on and then off which adds a bit of time to the whole procedure I'm running.

Any help would be much appreciated.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Try putting a space after the comma ", " for the join.
 
Upvote 0
Another option if you don't want the space is
VBA Code:
Sub ConcatCells()
   With Range("E2:E" & Range("A" & Rows.Count).End(xlUp).Row)
      .NumberFormat = "@"
      .Value = Evaluate(.Offset(, -2).Address & "&"",""&" & .Offset(, -1).Address)
   End With
End Sub
 
Upvote 0
Solution
Fluff

Should of said that I didn't want to add a space. However, your second option does what I've been trying to do.

Prefer and thanks for your help.
Jon
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,243
Members
449,075
Latest member
staticfluids

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