Maroon
05-21-2017, 09:24 AM
Hi,
I'm trying to concatenate cells of column A with cells of column C in the third column D. I wrote the code below but I can see only the last result in the column F.
I think there is a problem with the incrementation ...:think:
Sub test()
Sheets("feuil1").Activate
Dim maplage1, maplage3, maplage4 As Range
Dim c, d As Range
Dim derligne1, derligne3 As Long
derligne1 = Range("A" & Rows.Count).End(xlUp).Row
derligne3 = Range("C" & Rows.Count).End(xlUp).Row
Set maplage1 = Range(Cells(2, 1), Cells(derligne1, 1))
Set maplage3 = Range(Cells(2, 3), Cells(derligne3, 3))
Set maplage4 = Range("D2")
For Each c In maplage1
For Each d In maplage3
maplage4 = c.Value & "_" & d.Value
Next d
Next c
End Sub
Does somebody can help!?!
I'm trying to concatenate cells of column A with cells of column C in the third column D. I wrote the code below but I can see only the last result in the column F.
I think there is a problem with the incrementation ...:think:
Sub test()
Sheets("feuil1").Activate
Dim maplage1, maplage3, maplage4 As Range
Dim c, d As Range
Dim derligne1, derligne3 As Long
derligne1 = Range("A" & Rows.Count).End(xlUp).Row
derligne3 = Range("C" & Rows.Count).End(xlUp).Row
Set maplage1 = Range(Cells(2, 1), Cells(derligne1, 1))
Set maplage3 = Range(Cells(2, 3), Cells(derligne3, 3))
Set maplage4 = Range("D2")
For Each c In maplage1
For Each d In maplage3
maplage4 = c.Value & "_" & d.Value
Next d
Next c
End Sub
Does somebody can help!?!