Imprimer x page en fonction Combobox

  • Initiateur de la discussion Initiateur de la discussion Cougar
  • Date de début Date de début

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 !

Cougar

XLDnaute Impliqué
Bonjour le forum,

J'ai un combobox qui demande combien de pages doit être imprimées. Lorsque je lance l'impression il faut que la quantité de page soit en fonction du combobox.

Comment faire.

Voici le code le fichier compressé dépassant les 50K

Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub CommandButton2_Click()
var1 = ComboBox1.Value
var2 = ComboBox2.Value
var3 = ComboBox3.Value

Worksheets("sheet1").Activate
Range("b4") = ComboBox1.Value
Range("b16") = ComboBox3.Value

If ComboBox3 = "ARJO HUNTLEGH EERSEL" Then
Worksheets("sheet2").Activate
Range("h2").Activate
ActiveCell = ActiveCell + 1
End If
If ComboBox3 = "AUSTRALIE" Then
Worksheets("sheet2").Activate
Range("h3").Activate
ActiveCell = ActiveCell + 1
End If
If ComboBox3 = "JOERN UK" Then
Worksheets("sheet2").Activate
Range("h4").Activate
ActiveCell = ActiveCell + 1
End If

ComboBox1 = ""
ComboBox2 = ""
ComboBox3 = ""

'impression
Worksheets("sheet1").Activate
Range("A1:F16").Select
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""

'impression

If MsgBox("Voulez-vous imprimer des étiquettes pour un autre container ?", vbYesNo + vbQuestion, "Nouveau container ?") = vbYes Then
Worksheets("sheet1").Activate
Range("a5").Activate
ActiveCell = ActiveCell + 1
Range("b4") = ""
Range("b16") = ""
Else
Unload Me
Exit Sub
End If

ActiveWorkbook.Save
End Sub

Private Sub CommandButton3_Click()
Worksheets("sheet1").Activate
Range("b4") = ""
Range("b16") = ""
ComboBox1 = ""
ComboBox2 = ""
ComboBox3 = ""
End Sub

Private Sub UserForm_Initialize()
Dim c As Range
Dim d As Range
Dim e As Range
Dim X As New Collection
Dim y As New Collection
Dim z As New Collection

With Sheets("Sheet2")
For Each c In .Range("a1:a52")
On Error Resume Next
X.Add c, CStr(c)
If Err = 0 Then ComboBox1.AddItem (CStr(c))
On Error GoTo 0
Next c
End With

With Sheets("Sheet2")
For Each d In .Range("b1:b52")
On Error Resume Next
y.Add d, CStr(d)
If Err = 0 Then ComboBox2.AddItem (CStr(d))
On Error GoTo 0
Next d
End With

With Sheets("Sheet2")
For Each e In .Range("c1:c3")
On Error Resume Next
z.Add e, CStr(e)
If Err = 0 Then ComboBox3.AddItem (CStr(e))
On Error GoTo 0
Next e
End With

End Sub



Merci
 
- 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

Réponses
4
Affichages
355
Réponses
3
Affichages
586
Réponses
2
Affichages
421
Retour