Sub test()
' Cette macro fait tous a la suite (module 1 a tester sur feuil1)
Dim tab1() As Variant
fin = Range("a65536").End(xlUp).Row
tab1 = Range(Cells(1, 1), Cells(fin, 1))
ReDim Preserve tab1(1 To fin, 1 To 2)
For i = LBound(tab1, 1) To UBound(tab1, 1)
tab1(1, 2) = tab1(1, 2) & tab1(i, 1) & "','"
' Debug.Print tab1(1, 2)
Next i
' Debug.Print Left(tab1(1, 2), Len(tab1(1, 2)) - 2)
tab1(1, 2) = "'" & Left(tab1(1, 2), Len(tab1(1, 2)) - 2)
Cells(1, 2).Resize(UBound(tab1, 1)) = Application.Index(tab1, , 2)
End Sub
'******************************************************************************
Sub TestSiVides()
' Cette macro fait tous si ce n'est pas a la suite ou si c'est à la suite (module 2 a tester sur feuil2)
' double utilisation pour cette macro
Dim tab1() As Variant
fin = Range("a65536").End(xlUp).Row
tab1 = Range(Cells(1, 1), Cells(fin, 1))
ReDim Preserve tab1(1 To fin, 1 To 2)
For i = LBound(tab1, 1) To UBound(tab1, 1)
If tab1(i, 1) <> Empty Then
tab1(1, 2) = tab1(1, 2) & tab1(i, 1) & "','"
' Debug.Print tab1(1, 2)
End If
Next i
' Debug.Print Left(tab1(1, 2), Len(tab1(1, 2)) - 2)
tab1(1, 2) = "'" & Left(tab1(1, 2), Len(tab1(1, 2)) - 2)
Cells(1, 2).Resize(UBound(tab1, 1)) = Application.Index(tab1, , 2)
End Sub