papapaul
XLDnaute Impliqué
Auant de classeurs que de feuilles apres ca, je comprends pas 😡
Private Sub CommandButton1_Click()
'Copie plusieurs feuilles pour enregistrer
Dim wb As Workbook
Dim i As Integer
Dim tmp As Integer
Dim myarray() As Variant
Set wb = ThisWorkbook
With ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) = True Then
ReDim Preserve myarray(tmp)
myarray(tmp) = ListBox1.List(i)
tmp = tmp + 1
End If
Next
End With
For i = 0 To UBound(myarray)
wb.Worksheets(myarray).Copy
Next i
Application.Dialogs(xlDialogSaveAs).Show
UserForm1.Hide
End Sub
Private Sub CommandButton1_Click()
'Copie plusieurs feuilles pour enregistrer
Dim wb As Workbook
Dim i As Integer
Dim tmp As Integer
Dim myarray() As Variant
Set wb = ThisWorkbook
With ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) = True Then
ReDim Preserve myarray(tmp)
myarray(tmp) = ListBox1.List(i)
tmp = tmp + 1
End If
Next
End With
For i = 0 To UBound(myarray)
wb.Worksheets(myarray).Copy
Next i
Application.Dialogs(xlDialogSaveAs).Show
UserForm1.Hide
End Sub