PDA

View Full Version : [SOLVED] If column F is not empty merge data with column C



parscon
06-18-2016, 02:25 AM
Hello Friends
I need your help for merge 2 column
I have Column C and F i need a VBA code that check column F if is not empty merge the data with column C

Like

16423

Please help me if you can . Thank you so much for your help

offthelip
06-18-2016, 03:54 AM
The really simple slow way to do this is:

lastrow = sht.Cells(sht.Rows.Count, "C").End(xlUp).Row
For i = 1 To lastrow
If Cells(i, 6) <> "" Then
Cells(i, 3) = Cells(i, 3) & Cells(i, 6)
End If
Next i




this is a really slow way of doing this since the vba does multiple accesses to the worksheet. It woulkd be much quicker to use varinat arrays.

mdmackillop
06-18-2016, 04:35 AM
No need to check for empty cells.

For i = 1 To lastrow
Cells(i, 3) = Cells(i, 3) & Cells(i, 6)
Next i