Bonsoir,
j'ai un classeur qui contient 377 feuilles, il devient très lent à la fermeture avec sauvegarde. je veux l'éclater en créant un classeur par onglet. chaque nouveau classeur aura le même nom que la feuille qu'il contiendra.
j'ai fais cette macro mais elle ne marche pas.
merci pour votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 Sub create_feuille_par_classeur() Dim xlApp As New Excel.Application Dim xlBook As Excel.Workbook Dim xlBook1 As Excel.Workbook Dim xlSheet As Excel.Worksheet Dim strPath As String strPath = ThisWorkbook.Path Set xlBook1 = ThisWorkbook Set xlBook = xlApp.Workbooks.Add For Each xlSheet In xlBook1.Sheets xlSheet.Copy xlBook.Sheets(1).Name = xlSheet.Name xlBook.Sheets(1).Paste xlBook.SaveAs strPath & "\" & xlSheet.Name Next xlSheet Set xlBook = Nothing Set xlSheet = Nothing Set xlBook1 = Nothing xlApp.Quit End Sub
Partager