Public mijnboolean As Boolean
Private Sub CommandButton1_Click()
Parent.DisplayAlerts = False
Dim i As Integer
Worksheets.Add().Name = "Afdrukken"
With Sheets("Afdrukken")
Range("B2:H2").Select
Range("B2") = "Magazijnbeheer - geresveerde bakkenlijst"
With Selection
.Font.Name = "Comic Sans MS"
.Font.Size = 26
.Font.Underline = xlUnderlineStyleSingle
.MergeCells = True
End With
For i = 0 To UserForm3.Listbox1.ListCount - 1 ' Bied de mogelijkheid om kolommen weg te laten voor het afdrukken
x = y + 4
Sheets("Afdrukken").Range("A" & x) = UserForm3.Listbox1.Column(0, i)
Sheets("Afdrukken").Range("B" & x) = UserForm3.Listbox1.Column(1, i)
Sheets("Afdrukken").Range("C" & x) = UserForm3.Listbox1.Column(2, i)
Sheets("Afdrukken").Range("D" & x) = UserForm3.Listbox1.Column(3, i)
Sheets("Afdrukken").Range("E" & x) = UserForm3.Listbox1.Column(4, i)
Sheets("Afdrukken").Range("F" & x) = UserForm3.Listbox1.Column(5, i)
Sheets("Afdrukken").Range("G" & x) = UserForm3.Listbox1.Column(6, i)
Sheets("Afdrukken").Range("H" & x) = UserForm3.Listbox1.Column(7, i)
Sheets("Afdrukken").Range("I" & x) = UserForm3.Listbox1.Column(8, i)
Sheets("Afdrukken").Range("J" & x) = UserForm3.Listbox1.Column(9, i)
Sheets("Afdrukken").Range("K" & x) = UserForm3.Listbox1.Column(10, i)
Sheets("Afdrukken").Range("L" & x) = UserForm3.Listbox1.Column(11, i)
y = y + 1
Next i
Range("A4:L4").Select
With Selection
.Interior.ThemeColor = xlThemeColorDark1
.Interior.TintAndShade = -0.249977111117893
.Font.Name = "Comic Sans MS"
.Borders.LineStyle = xlContinuous
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlTop
End With
Iroweinde = Range("b400").End(xlUp).row
Range("A5" & ":" & "L" & Iroweinde).Select
With Selection
.Font.Name = "Comic Sans MS"
.Borders.LineStyle = xlContinuous
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlTop
End With
Range("G5" & ":" & "H" & Iroweinde).NumberFormat = "0"
Range("A5" & ":" & "A" & Iroweinde).NumberFormat = "0"
.Rows.EntireRow.AutoFit
Columns("A:L").EntireColumn.AutoFit
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
End With
mijnboolean = True
.PrintOut
End With
Sheets("Afdrukken").Delete
Parent.DisplayAlerts = True
Unload UserForm1
End Sub