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
Excel.jpg
Please help me if you can . Thank you so much for your help
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
Excel.jpg
Please help me if you can . Thank you so much for your help
The really simple slow way to do this is:
[VBA]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
[/VBA]
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.
No need to check for empty cells.
For i = 1 To lastrow Cells(i, 3) = Cells(i, 3) & Cells(i, 6) Next i
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'