29.03.2018, 13:33
Habe die Tabelle nicht angeschaut. 2401 für nur 128. Für jeden 4er Schritt bis 176 entsprechend noch mal. Aber immer noch überschaubar.
Sub ErstelleParts()
Dim Seite As Byte
Dim Divisor(1 To 7)
Dim Teil1
Dim Teil2
Dim Teil3
Dim Teil4
Dim Zwischensumme
; folgende Daten aus Tabelle auslesen:
Seite = 128
Divisor(1) = 16
Divisor(2) = 20
Divisor(3) = 24
Divisor(4) = 28
Divisor(5) = 32
Divisor(6) = 40
Divisor(7) = 48
For Teil1 = 1 To 7
For Teil2 = 1 To 7
For Teil3 = 1 To 7
For Teil4 = 1 To 7
Zwischensumme = Divisor(Teil1) + Divisor(Teil2) + Divisor(Teil3) + Divisor(Teil4)
If Zwischensumme = Seite Then
Debug.Print Divisor(Teil1); Divisor(Teil2); Divisor(Teil3); Divisor(Teil4)
End If
Next
Next
Next
Next
End Sub
Sub ErstelleParts()
Dim Seite As Byte
Dim Divisor(1 To 7)
Dim Teil1
Dim Teil2
Dim Teil3
Dim Teil4
Dim Zwischensumme
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Z = 17
s = 2
For s = 2 To 12
' folgende Daten aus Tabelle auslesen:
Seite = Range("A" & s).Value
Divisor(1) = Range("B2").Value
Divisor(2) = Range("B3").Value
Divisor(3) = Range("B4").Value
Divisor(4) = Range("B5").Value
Divisor(5) = Range("B6").Value
Divisor(6) = Range("B7").Value
Divisor(7) = Range("B8").Value
For Teil1 = 1 To 7
For Teil2 = 1 To 7
For Teil3 = 1 To 7
For Teil4 = 1 To 7
Zwischensumme = Divisor(Teil1) + Divisor(Teil2) + Divisor(Teil3) + Divisor(Teil4)
If Zwischensumme = Seite Then
Range("B" & Z) = (Divisor(Teil1) & ";" & Divisor(Teil2) & ";" & Divisor(Teil3) & ";" & Divisor(Teil4))
Range("A" & Z) = Seite
Z = Z + 1
End If
Next
Next
Next
Next
Next
Call Splitten
Application.ScreenUpdating = True
End Sub