1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| Sub ConcatenerColonnes()
Dim ws As Worksheet
Dim lastRow As Long
Dim i As Long
Set ws = ThisWorkbook.Worksheets("extrac plannif")
' Trouver la dernière ligne utilisée dans la colonne F
lastRow = ws.Cells(ws.Rows.Count, "F").End(xlUp).Row
' Boucle pour concaténer les colonnes F et R dans la colonne S
For i = 1 To lastRow
If ws.Cells(i, "F").Value <> "" And ws.Cells(i, "R").Value <> "" Then
ws.Cells(i, "S").Value = ws.Cells(i, "F").Value & " - " & ws.Cells(i, "R").Value
Else
ws.Cells(i, "S").Value = ""
End If
Next i
MsgBox "Concaténation terminée dans la colonne S", vbInformation
End Sub |
Partager