Merge 2 cells for Range

Eclektics

New Member
Joined
Jun 9, 2015
Messages
24
Hi All,

I'm trying to merge 2 lots of columns into 1 column at the end of the data to provide a look up reference. The first column contains staff ID and the second contains question ID.

My code is below and it just doesn't seem to work, I get a type mismatch but guides I've followed suggest the below code. Any help anyone can offer would be greatly appreciated. For reference, column BI will never have data on the sheet so I'm using it as a 'safe column' for the merge as I know will always be empty.

Code:
Dim dws as Worksheet
Dim LRow as long

Set dws = Sheets("Data")

LRow = dws.Cells(dws.Rows.Count, "A").End(xlUp).Row

dws.Range("BI2:BI" & LRow) = Range(Cells(2, 4).Address(False, False), (Cells(2, 25).Address(False, False))).Merge
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
How about
Code:
Sub MyConcat()
   Dim Lr As Long
   
   Lr = Range("A" & Rows.Count).End(xlUp).Row
   With Range("BI2:BI" & Lr)
      .FormulaR1C1 = "=rc4&rc25"
      .Value = .Value
   End With
End Sub
 
Upvote 0
Hi Fluff,

Thanks for the quick response. The code runs without error but nothing appears in column BI once it's ran.
 
Upvote 0
Scratch that last response, it worked but I didn't reference the sheet I wanted it to work on.. whoops lol

Thank you so much for your help :) Are you able to quickly explain how it worked?
 
Upvote 0
This line
Code:
.FormulaR1C1 = "=rc4&rc25"
puts a formula into the entire column looking at col 4 & 25 for that row and this line
Code:
.Value = .Value
Then converts the formula to values
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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