Concatenating two columns of data using a formula and the autofill command

rahulkumar88

New Member
Joined
Apr 9, 2011
Messages
16
Hi!
I need to concatenate two columns of data which are selected by the user. So the macro searches through the column headings to locate the required columns and then will concatenate them.
I'm able perform this task by running a loop through all the rows of data. The problem however is that I'm working with a significant amount of data (approx. 35000 rows) and it takes a couple of minutes for the loop to execute.
I was hoping to use a concatenation formula for the first row and then follow that up with the autofill command to work on the rest of the data. That process barely takes a few seconds when you do it manually. Unfortunately I'm unable to give the references for the required columns in the formula.
For example if I use the following formula
Range("J2").Formula = "=F2 & ""_"" & H2"
I want to know how to reference the user defined columns on the RHS.
I'd appreciate any help that you could provide.
Thanks in advance.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
It worked!
Thanks a lot. It works brilliantly and breezes through the entire data in a flash.
Just what I was hoping for. Thanks once again!
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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