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