1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Private Sub CommandButton2_Click()
Dim Tableau() As Variant
Dim i As Integer
Dim j As Byte
Application.ScreenUpdating = False
Sheets.Add 'création d'une nouvelle feuille temporaire
Tableau() = ListBox1.List
j = ListBox1.ColumnCount
i = ListBox1.ListCount
Range(Cells(i, j), Cells(Me.ListBox1.ListCount)) = Tableau()
'option pour adapter la largeur des colonnes à la taille des données
ActiveSheet.Range("A1:" & Cells(i, j).Address).EntireColumn.AutoFit
'ActiveSheet.PrintOut 'impression
'Application.DisplayAlerts = False
'ActiveSheet.Delete
'Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub |