1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Sub Macro5()
Dim premiere_ligne As Integer
Dim derniere_ligne As Integer
Dim machaine As String
Dim la_colonne As Long
Range("D15").Select
Range(Selection, Selection.End(xlDown)).Select
la_colonne = ActiveWindow.RangeSelection.Column
' recherche de la premier ligne
premiere_ligne = ActiveWindow.RangeSelection.Row
' et de la derniere ligne
derniere_ligne = ActiveWindow.RangeSelection.Rows.Count + premiere_ligne - 1
machaine = ActiveSheet.Cells(premiere_ligne, la_colonne).Value
For i = premiere_ligne + 1 To derniere_ligne
machaine = machaine & "," & ActiveSheet.Cells(i, la_colonne).Value
Next i
' pour l'exemple, je mets le résultat dans la cellule A1
ActiveSheet.Cells(1, 1).Value = machaine
End Sub |
Partager