I want to use a macro to save only some predefined sheets in a new workbooks.
I use a userform
to ask for the name of the new file, create it and open it, then copy and paste sheets one by one from the old to the new file.
This already take a lot of time to run, and this will get worse as I get more and more data in my sheets to copy and paste.
Is there another way to proceed ?
Here is my code:
WB2
is the old book, Ws
is the worksheet in the old book, WB
is the new book, Dico_export
is a dictionary containing the name of sheets to be copied.
For Each WS In WB2.Worksheets
If Dico_Export.Exists(WS.Name) Then
WB2.Worksheets(WS.Name).Copy after:=WB.Sheets(1 + i)
If WS.Name <> "Limites LPG" Then
tabl(i) = WS.Name
End If
i = i + 1
End If
Next