regrouper plusieurs macro en un seul bouton

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

tonychange

XLDnaute Occasionnel
Bonjour,
J'aimerais savoir si il est possible de regrouper plusieurs macro en un seul bouton sur excel??
Dans mon cas, j'ai 6 macros et j'aimerais regrouper ces 3 formules dans 1 bouton.

merci d"avance
 
Re : regrouper plusieurs macro en un seul bouton

voici mes macros

j'ai rajouté la focntion mais ca ne fonctionne pas

Sub Macro1()
'
' Macro1 Macro
' Macro enregistrée le 08/07/2009 par ritchy
'

'
Rows("1:2").Select
Selection.Delete Shift:=xlUp
ActiveSheet.Shapes("Picture 1").Select
Selection.Delete
Range("A1:M1").Select
Selection.Interior.ColorIndex = 6
Selection.Font.Bold = True
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Columns("E:E").Select
Selection.Cut
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
Range("A1😀1").Select
Selection.Interior.ColorIndex = 6
Range("B1").Select
ActiveCell.FormulaR1C1 = "ORDER"
Range("C1").Select
ActiveCell.FormulaR1C1 = "GROUP"
Range("A1😀1").Select
Selection.Font.Bold = False
Selection.Font.Bold = True
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A1😀1").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Columns("G:G").Select
Selection.Insert Shift:=xlToRight
Range("G1").Select
ActiveCell.FormulaR1C1 = "SIZE (TEU)"
With ActiveCell.Characters(Start:=1, Length:=10).Font
.Name = "Tahoma"
.FontStyle = "Gras"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
Range("G4").Select
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 5
Columns("K:K").Select
Selection.Insert Shift:=xlToRight
Columns("L:L").Select
Selection.Insert Shift:=xlToRight
Range("K1").Select
ActiveCell.FormulaR1C1 = "MOI1"
With ActiveCell.Characters(Start:=1, Length:=4).Font
.Name = "Tahoma"
.FontStyle = "Gras"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
Range("L1").Select
ActiveCell.FormulaR1C1 = "MOI2"
With ActiveCell.Characters(Start:=1, Length:=4).Font
.Name = "Tahoma"
.FontStyle = "Gras"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
Columns("O:O").Select
Selection.Insert Shift:=xlToRight
Range("O1").Select
ActiveCell.FormulaR1C1 = "MOI3"
With ActiveCell.Characters(Start:=1, Length:=4).Font
.Name = "Tahoma"
.FontStyle = "Gras"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
ActiveWorkbook.Save
End Sub
Sub Macro2()
'
' Macro2 Macro
' Macro enregistrée le 08/07/2009 par ritchy
'

'
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 6
Columns("K:K").Select
Selection.Insert Shift:=xlToRight
Range("K1").Select
ActiveCell.FormulaR1C1 = "MOI3"
With ActiveCell.Characters(Start:=1, Length:=4).Font
.Name = "Tahoma"
.FontStyle = "Gras"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
Columns("L:L").Select
Selection.Insert Shift:=xlToRight
Range("L1").Select
ActiveCell.FormulaR1C1 = "MOI4"
With ActiveCell.Characters(Start:=1, Length:=4).Font
.Name = "Tahoma"
.FontStyle = "Gras"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
Columns("M:M").Select
Selection.Insert Shift:=xlToRight
Range("M1").Select
ActiveCell.FormulaR1C1 = "MOI5"
With ActiveCell.Characters(Start:=1, Length:=4).Font
.Name = "Tahoma"
.FontStyle = "Gras"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
Range("M5").Select
End Sub

Private Sub CommandButton4_Click()

Macro1
Macro2


End Sub
 
Bonjour.
La réponse de Pierrot93 s'applique à un bouton ActiveX nommé CommandButton1, et le code doit être mis dans le module de la feuille le contenant.
S'il s'agit d'un bouton de formulaire le code doit être mis dans un module standard et la procédure, qui ne doit pas être Private, doit être affectée au bouton.
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

  • Question Question
XL pour MAC Graphique
Réponses
12
Affichages
467
Réponses
3
Affichages
173
Réponses
33
Affichages
1 K
Réponses
15
Affichages
526
W
Retour