comment associer deux modules a un seul bouton

doudou080

XLDnaute Nouveau
bonjour a tous
je cherche mais je ne trouve rien qui correspond a mon besoin.
est il possible d'associer 2 modules a un seul bouton UserForm

module1

Sub ImprimerUnBonDeReception()
UserForm1.Show
End Sub

Sub Imprimer()

Dim fs, fb
Set fs = ActiveSheet
Set fb = Sheets("bon de reception")
If Intersect(ActiveCell, Range("E10:E" & Range("E" & 65536).End(xlUp).Row)) Is Nothing Then
MsgBox "selection incorrecte." & Chr(13) & "Vous devez sélectionner un numéro de commande.", 16
End
Else
r = MsgBox("Vous allez imprimer le bon de réception de la commande " & ActiveCell & Chr(13) & _
"Confirmez-vous ?", 4)
If r = 7 Then End
End If

ln = ActiveCell.Row
For i = 1 To 6
t1 = Choose(i, "A", "C", "D", "F", "M", "E")
t2 = Choose(i, "D14:D15", "F14:F15", "E35:E36", "D17:D18", "F20:F21", "E6:E7")
fs.Range(t1 & ln).Copy fb.Range(t2)
Next i
fb.Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
fs.Select
For i = 1 To 6
t2 = Choose(i, "D14:D15", "F14:F15", "E35:E36", "D17:D18", "F20:F21", "E6:E7")
fb.Range(t2).ClearContents

Next i
End Sub
module2


Sub Imprimer()

Dim fs, fb
Set fs = ActiveSheet
Set fb = Sheets("gestion des supports")
If Intersect(ActiveCell, Range("E10:E" & Range("E" & 65536).End(xlUp).Row)) Is Nothing Then
MsgBox "selection incorrecte." & Chr(13) & "Vous devez sélectionner un numéro de commande.", 16
End
Else
r = MsgBox("Vous allez imprimer le bon de réception de la commande " & ActiveCell & Chr(13) & _
"Confirmez-vous ?", 4)
If r = 7 Then End
End If

ln = ActiveCell.Row
For i = 1 To 5
t1 = Choose(i, "A", "B", "C", "F", "E")
t2 = Choose(i, "F8:G8", "E8", "F5:G5", "D21:E21", "G2")
fs.Range(t1 & ln).Copy fb.Range(t2)
Next i
fb.Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
fs.Select
For i = 1 To 5
t2 = Choose(i, "F8:G8", "E8", "F5:G5", "D21:E21", "G2")
fb.Range(t2).ClearContents
Next i
End Sub
cordialement votre
 

doudou080

XLDnaute Nouveau
bonjour a tous

pour associer 2 modules a un seul bouton UserForm
c'est ok pour moi avec ca que j'associe a mon bouton.( merci à Robert pour son aide )

Sub Macro2()
'
' Macro2 Macro
Module1.Imprimer
Module2.Imprimer
End Sub

changer la hauteur de police en (arial 10) alors que je suis en arial 24. pour les autres cellules c'est ok ( "F8:G8", "F5:G5", "D21:E21" )

c'est ok pour moi je m'en suis sortie avec l'enregistreur de macro.
que j'ai integré a ma macro
je sais c'est pas terible mais ca marche.
With Selection.Font
.Name = "Arial"
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
With Selection.Font
.Name = "Arial"
.Size = 18
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
With Selection
.VerticalAlignment = xlBottom
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection
.VerticalAlignment = xlCenter
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection.Font
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With

je pense que l'on peux fermer ce sujet.
merci a tous
 

Membres actuellement en ligne

Aucun membre en ligne actuellement.

Statistiques des forums

Discussions
312 196
Messages
2 086 101
Membres
103 116
dernier inscrit
kutobi87