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, "D1415", "F14:F15", "E35:E36", "D1718", "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, "D1415", "F14:F15", "E35:E36", "D1718", "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
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, "D1415", "F14:F15", "E35:E36", "D1718", "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, "D1415", "F14:F15", "E35:E36", "D1718", "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