Microsoft 365 Combinaison de 2 macros

homernell

XLDnaute Occasionnel
Bonjour à tous,

J'aimerai savoir s'il est possible de combiner ces deux macros :

1.
Worksheets(Array("Prog Mer dim", "Box office")).Copy

ActiveWorkbook.SaveAs _
Filename:="Résultats pour prog.xlsm", _
FileFormat:=xlOpenXMLWorkbookMacroEnabled, _
CreateBackup:=False

ActiveWindow.Close

End Sub


2.
Sheets("Prog Mer DIm").Select
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Box Office").Select
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Prog Mer DIm").Select


Merci d'avance pour vos réponses.
 

job75

XLDnaute Barbatruc
Bonsoir homernell, Bruno,
VB:
Sub Test()
Dim w As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Sheets(Array("Prog Mer dim", "Box office")).Copy
With ActiveWorkbook
    For Each w In .Worksheets
        w.UsedRange = w.UsedRange.Value
    Next
    .SaveAs ThisWorkbook.Path & "\Résultats pour prog.xlsm", 52
    .Close
End With
End Sub
A+
 

homernell

XLDnaute Occasionnel
Bonsoir homernell, Bruno,
VB:
Sub Test()
Dim w As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Sheets(Array("Prog Mer dim", "Box office")).Copy
With ActiveWorkbook
    For Each w In .Worksheets
        w.UsedRange = w.UsedRange.Value
    Next
    .SaveAs ThisWorkbook.Path & "\Résultats pour prog.xlsm", 52
    .Close
End With
End Sub
A+
Super je vais essayer
 

Statistiques des forums

Discussions
299 847
Messages
1 979 553
Membres
206 771
dernier inscrit
Charles Fabre