View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Valeria Valeria is offline
external usenet poster
 
Posts: 127
Default quicker cell concatenation

I am baffled - both solutions (Jabob and JLatham) work beautifully and make
me save at least 20 min/run! Thanks a lot!
--
Valeria


"Jacob Skaria" wrote:

The second line split to two....

Range(Cells(1, 7), Cells(lastRow, 7)).Formula = "=A1&B1&C1&D1&E1&F1"
Range(Cells(1, 7), Cells(lastRow, 7)) = _
Range(Cells(1, 7), Cells(lastRow, 7)).Value


--
Jacob (MVP - Excel)


"Jacob Skaria" wrote:

Try the below non-looping code

Range(Cells(1, 7), Cells(lastRow, 7)).Formula = "=A1&B1&C1&D1&E1&F1"
Range(Cells(1, 7), Cells(lastRow, 7)) = Range(Cells(1, 7), Cells(lastRow,
7)).Value


--
Jacob (MVP - Excel)


"Valeria" wrote:

Dear experts,
I want to fill in a range (column) with concatenation data from other 4
columns.
The number of rows is quite big so it takes a while before vba can finish
the task. My code looks like
For i = 1 to LastRow
Cells(i, 7)=Cells(i,1) & Cells(7,2) & Cells(i,3) & Cells(1,4) & Cells(i,5) &
Cells(i,6)
Next i

Is there another way to do this more quickly, maybe playing with ranges?
Thanks a lot for your advice.
Kind regards

--
Valeria