1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
| Public Sub calcul()
Dim xlapp As Excel.Application
Dim xlsheet As Excel.Worksheet
Dim xlBook As Excel.Workbook
Dim X As Integer
Dim anzahlPal As Integer
Dim Auflage As Long, exPal As Long, ExVB As Long, VBlage As Long, lagPal As Long, gewichtex As Long
Dim aufTrag As String, matchCode As String, verSSion As String, Verpackung As String
Dim Adresse As String, straSse As String, oRt As String
Dim belege As Long, auflageohne As Long
Dim nrcodebarre As Integer
Dim mgljobno As String
Dim mgldelivery As Date
On Error GoTo gestionerreur
Set xlapp = Excel.Application
Call transfin
Worksheets("historik").Activate
With Worksheets("historik")
nrcodebarre = Application.WorksheetFunction.Max(Columns(1))
End With
Set xlBook = xlapp.ActiveWorkbook
If USFEintrag.belege = "" Then USFEintrag.belege.Value = "0" Else
If USFEintrag.gewex = "" Then USFEintrag.gewex.Value = "0" Else
aufTrag = USFEintrag.Objekt
matchCode = USFEintrag.Auftragnr & " / " & USFEintrag.HeftNr
verSSion = USFEintrag.Version
Auflage = USFEintrag.Auflagegesamt
belege = USFEintrag.belege
Adresse = USFEintrag.Adresse.Column(1)
straSse = USFEintrag.Adresse.Column(2)
oRt = USFEintrag.Adresse.Column(3)
auflageohne = Auflage - belege
Verpackung = USFEintrag.Verpackung
mgljobno = USFEintrag.JobMgl
mgldelivery = USFEintrag.deliverymgl
gewichtex = USFEintrag.gewex
Select Case USFEintrag.ExVB
Case Is = ""
anzahlPal = InputBox("Anzahl von Paletten // Wickel")
If anzahlPal < 1 Then
MsgBox "Ich brauche min. 1 Pal."
Exit Sub
Else
End If
Case Else
ExVB = USFEintrag.ExVB
If USFEintrag.VBlage = "" Then VBlage = "1" Else VBlage = USFEintrag.VBlage
If USFEintrag.Lage = "" Then lagPal = "1" Else lagPal = USFEintrag.Lage
exPal = ExVB * VBlage * lagPal
anzahlPal = WorksheetFunction.RoundUp((auflageohne / exPal), 0)
End Select
'Ajouter une feuille de calcul
Set xlsheet = xlBook.Worksheets.Add
xlsheet.name = "pzt_Liste"
'le titre - Entete
xlsheet.Cells(1, 1) = "Auftrag:"
xlsheet.Cells(1, 2) = matchCode & "_" & aufTrag
xlsheet.Cells(2, 1) = "Split:"
xlsheet.Cells(2, 2).NumberFormat = "@"
xlsheet.Cells(2, 2) = verSSion
xlsheet.Cells(1, 5) = "Auflage:"
xlsheet.Cells(1, 6) = Auflage
xlsheet.Cells(1, 6).NumberFormat = "###,###"
xlsheet.Cells(2, 8).FormulaLocal = "=summe(B:B)"
xlsheet.Cells(2, 8).NumberFormat = "###,###"
xlsheet.Cells(1, 7) = "Bereist.:"
xlsheet.Cells(1, 8) = mgldelivery
xlsheet.Cells(2, 9) = Date$
xlsheet.Cells(1, 9) = Environ("Username")
xlsheet.Cells(3, 1) = "Palette Nr."
Select Case USFEintrag.Verpackung.Value
Case Is = ("Gewickelt")
xlsheet.Cells(3, 2) = "Exemplare im Wickel"
xlsheet.Cells(3, 3) = ""
xlsheet.Cells(3, 4) = ""
xlsheet.Cells(3, 5) = ""
xlsheet.Cells(3, 6) = ""
xlsheet.Cells(3, 7) = ""
Case Is = ("auf Stange"), ("Stange")
xlsheet.Cells(3, 2) = "Exemplare auf der Palette"
xlsheet.Cells(3, 3) = "Exemplare / Stange"
xlsheet.Cells(3, 4) = "Stangen volle Palette"
xlsheet.Cells(3, 5) = "Anzahl Stange auf diese Palette" ' Attention inverse
xlsheet.Cells(3, 7) = "Anzahl Brettchen" ' Attention inverse
xlsheet.Cells(3, 6) = "Ex. in der letzte Stange"
xlsheet.Cells(2, 3) = "Maße der Brettchen"
'Cellule Brettchen Masse
Range("E2:F2").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.14996795556505
.PatternTintAndShade = 0
End With
Case Is = ("Plano (Roto5)")
xlsheet.Cells(3, 2) = "Exemplare auf der Palette"
xlsheet.Cells(3, 3) = ""
xlsheet.Cells(3, 4) = ""
xlsheet.Cells(3, 5) = ""
xlsheet.Cells(3, 6) = ""
Case Else
xlsheet.Cells(3, 2) = "Exemplare auf der Palette"
xlsheet.Cells(3, 3) = "Exemplare im VB"
xlsheet.Cells(3, 4) = "VB/Lage"
xlsheet.Cells(3, 5) = "Anzahl VB auf diese Palette"
xlsheet.Cells(3, 6) = "Volle Lagen"
xlsheet.Cells(3, 7) = "+ Pakete"
End Select
xlsheet.Cells(3, 8) = "Verpackung"
xlsheet.Cells(3, 9) = "Unterschrift"
xlsheet.Cells(3, 10) = "Matchcode"
xlsheet.Cells(3, 11) = "Auftrag"
xlsheet.Cells(3, 12) = "Split"
xlsheet.Cells(3, 13) = "Auflage"
xlsheet.Cells(3, 14) = "Adresse"
xlsheet.Cells(3, 15) = "Strasse"
xlsheet.Cells(3, 16) = "Ort"
xlsheet.Cells(3, 17) = "AnzahlPaletten"
xlsheet.Cells(3, 18) = "CodePalette"
xlsheet.Cells(3, 19) = "JobNomegal"
xlsheet.Cells(3, 20) = "TerminMegal"
xlsheet.Cells(3, 21) = "Gewicht/Ex."
xlsheet.Cells(3, 22) = "Gewicht/Pal."
'debut de la boucle
For X = 1 To anzahlPal Step 1
Select Case USFEintrag.ExVB
Case Is = ""
Cells(X + 3, 1) = X
Cells(X + 3, 3) = ""
Cells(X + 3, 4) = ""
Cells(X + 3, 8) = Verpackung
Cells(X + 3, 10) = matchCode
Cells(X + 3, 11) = aufTrag
Cells(X + 3, 12).NumberFormat = "@"
Cells(X + 3, 12) = verSSion
Cells(X + 3, 13) = Auflage
Cells(X + 3, 13).NumberFormat = "###,###"
Cells(X + 3, 14) = Adresse
Cells(X + 3, 15) = straSse
Cells(X + 3, 16) = oRt
Cells(X + 3, 17) = anzahlPal
Cells(X + 3, 19) = mgljobno
Cells(X + 3, 20) = mgldelivery
Cells(X + 3, 21) = gewichtex
Cells(X + 3, 22).FormulaLocal = "=(B" & X + 3 & ") * (U" & X + 3 & ")/1000"
Cells(X + 3, 2).NumberFormat = "###,###"
If exPal * X < auflageohne _
Then Cells(X + 3, 2) = exPal _
Else: Cells(X + 3, 2) = auflageohne - (X - 1) * exPal 'Exemplare auf der Palette
Case Else
Cells(X + 3, 1) = X
Cells(X + 3, 8) = Verpackung
Cells(X + 3, 10) = matchCode
Cells(X + 3, 11) = aufTrag
Cells(X + 3, 12).NumberFormat = "@"
Cells(X + 3, 12) = verSSion
Cells(X + 3, 13) = Auflage
Cells(X + 3, 13).NumberFormat = "###,###"
Cells(X + 3, 14) = Adresse
Cells(X + 3, 15) = straSse
Cells(X + 3, 16) = oRt
Cells(X + 3, 17) = anzahlPal
Cells(X + 3, 19) = mgljobno
Cells(X + 3, 20) = mgldelivery
Cells(X + 3, 21) = gewichtex
Cells(X + 3, 22).FormulaLocal = "=(B" & X + 3 & ") * (U" & X + 3 & ")/1000"
Cells(X + 3, 2).NumberFormat = "###,###"
If exPal * X < auflageohne _
Then Cells(X + 3, 2) = exPal _
Else: Cells(X + 3, 2) = auflageohne - (X - 1) * exPal 'Exemplare auf der Palette
Select Case USFEintrag.Verpackung.Value
Case Is = ("Gewickelt")
Cells(X + 3, 3) = "" 'ExVB
Cells(X + 3, 4) = ""
Cells(X + 3, 5) = ""
Cells(X + 3, 6) = ""
Cells(X + 3, 7) = ""
Case Is = ("auf Stange")
Cells(X + 3, 3) = ExVB
Cells(X + 3, 4) = VBlage
Cells(X + 3, 5).FormulaLocal = "=aufrunden((B" & X + 3 & ") /(C" & X + 3 & ");0)" 'Anzahl VB auf d palette
Cells(X + 3, 7) = ""
If Cells(X + 3, 2) = Cells(X + 3, 3) * Cells(X + 3, 5) Then Cells(X + 3, 6) = "" _
Else Cells(X + 3, 6).FormulaLocal = "=aufrunden((B" & X + 3 & ") - (C" & X + 3 & ")*((E" & X + 3 & ")-1);0)" 'Attention inverse Nbre Brettchen
Case Is = ("Plano (Roto5)")
Cells(X + 3, 3) = ""
Cells(X + 3, 4) = ""
Cells(X + 3, 5) = ""
Cells(X + 3, 6) = ""
Cells(X + 3, 7) = ""
Case Else
Cells(X + 3, 3) = ExVB
Cells(X + 3, 4) = VBlage
Cells(X + 3, 5).FormulaLocal = "=aufrunden((B" & X + 3 & ") /(C" & X + 3 & ");0)" 'Anzahl VB auf d palette
Cells(X + 3, 6).FormulaLocal = "=abrunden((E" & X + 3 & ") / " & VBlage & ";0)" 'Volle Lagen
Cells(X + 3, 7).FormulaLocal = "=aufrunden(((B" & X + 3 & ")-((F" & X + 3 & " * " & VBlage & ")* C" & X + 3 & ")) / " & ExVB & " ;0)" 'Anzahl Pakete
End Select
End Select
'Creation du code
Cells(X + 3, 18).NumberFormat = "@"
Cells(X + 3, 18) = Format(mgljobno, "00000") & Format(nrcodebarre, "000") & Format(X, "000") |
Partager