Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1832to1836
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

VBA

VBA
11.06.2021 16:18:53
Markus
Hallo Forum ich bräuchte mal ein Tip. Zu folgendem Code unten.
Und zwar läuft das Programm durch aber ab V9 trifft VBA die Falsche Auswahl. Ich habe das Programm Step bei Step Laufen lassen und da macht es die Entscheidungen richtig. Kann mir jemand ein Tip geben? Würde gerne das Excel Teilen jedoch kriege ich es nicht unter 300kB.
Danke schon mal für eure Tips
If MW_prod_FillerV1 / SW_prod_FillerV1 > 1 And Tank_SpringwaterV0 < Tank_MineralwaterV0 Then GoTo V1_Line1 Else GoTo V1_Line2
V1_Line1:
Range("F17").Value = Range("F14").Value * (2 / 3)
Range("F18").Value = Range("F14").Value * (1 / 3)
GoTo V1_LineEND
V1_Line2:
If MW_prod_FillerV1 / SW_prod_FillerV1 < 0.1 And MW_prod_FillerV1 / SW_prod_FillerV1 < 1 And Tank_SpringwaterV0 <= Tank_MineralwaterV0 Then GoTo V1_Line3 Else GoTo V1_Line4
V1_Line3:
Range("F17").Value = Range("F14").Value * (1)
Range("F18").Value = Range("F14").Value * (0)
GoTo V1_LineEND
V1_Line4:
If MW_prod_FillerV1 / SW_prod_FillerV1 < 0.1 And MW_prod_FillerV1 / SW_prod_FillerV1 < 1 And Tank_SpringwaterV0 >= Tank_MineralwaterV0 Then GoTo V1_Line5 Else GoTo V1_Line6
V1_Line5:
Range("F17").Value = Range("F14").Value * (0)
Range("F18").Value = Range("F14").Value * (1)
GoTo V1_LineEND
V1_Line6:
If MW_prod_FillerV1 / SW_prod_FillerV1 > 0.1 And MW_prod_FillerV1 / SW_prod_FillerV1 < 1 And Tank_SpringwaterV0 >= Tank_MineralwaterV0 Then GoTo V1_Line7 Else GoTo V1_Line8
V1_Line7:
Range("F17").Value = Range("F14").Value * (0)
Range("F18").Value = Range("F14").Value * (1)
GoTo V1_LineEND
V1_Line8:
If MW_prod_FillerV1 / SW_prod_FillerV1 > 0.1 And MW_prod_FillerV1 / SW_prod_FillerV1 < 1 And Tank_SpringwaterV0 <= Tank_MineralwaterV0 Then GoTo V1_Line9 Else GoTo V1_Line10
V1_Line9:
Range("F17").Value = Range("F14").Value * (1)
Range("F18").Value = Range("F14").Value * (0)
GoTo V1_LineEND
V1_Line10:
If MW_prod_FillerV1 / SW_prod_FillerV1 < 1 And MW_prod_FillerV1 / SW_prod_FillerV1 > 0.1 Then GoTo V1_Line11 Else GoTo V1_Line12
V1_Line11:
Range("F17").Value = Range("F14").Value / 2
Range("F18").Value = Range("F14").Value / 2
GoTo V1_LineEND
V1_Line12:
If MW_prod_FillerV1 / SW_prod_FillerV1 > 1 And Tank_SpringwaterV0 >= Tank_MineralwaterV0 Then GoTo V1_Line13
V1_Line13:
Range("F17").Value = Range("F14").Value * (1 / 3)
Range("F18").Value = Range("F14").Value * (2 / 3)
GoTo V1_LineEND
V1_LineEND:
If MW_prod_FillerV2 / SW_prod_FillerV2 > 1 And Tank_SpringwaterV1 < Tank_MineralwaterV1 Then GoTo V2_Line1 Else GoTo V2_Line2
V2_Line1:
Range("G17").Value = Range("G14").Value * (2 / 3)
Range("G18").Value = Range("G14").Value * (1 / 3)
GoTo V2_LineEND
V2_Line2:
If MW_prod_FillerV2 / SW_prod_FillerV2 < 0.1 And MW_prod_FillerV2 / SW_prod_FillerV2 < 1 And Tank_SpringwaterV1 <= Tank_MineralwaterV1 Then GoTo V2_Line3 Else GoTo V2_Line4
V2_Line3:
Range("G17").Value = Range("G14").Value * (1)
Range("G18").Value = Range("G14").Value * (0)
GoTo V2_LineEND
V2_Line4:
If MW_prod_FillerV2 / SW_prod_FillerV2 < 0.1 And MW_prod_FillerV2 / SW_prod_FillerV2 < 1 And Tank_SpringwaterV1 >= Tank_MineralwaterV1 Then GoTo V2_Line5 Else GoTo V2_Line6
V2_Line5:
Range("G17").Value = Range("G14").Value * (0)
Range("G18").Value = Range("G14").Value * (1)
GoTo V2_LineEND
V2_Line6:
If MW_prod_FillerV2 / SW_prod_FillerV2 > 0.1 And MW_prod_FillerV2 / SW_prod_FillerV2 < 1 And Tank_SpringwaterV1 >= Tank_MineralwaterV1 Then GoTo V2_Line7 Else GoTo V2_Line8
V2_Line7:
Range("G17").Value = Range("G14").Value * (0)
Range("G18").Value = Range("G14").Value * (1)
GoTo V2_LineEND
V2_Line8:
If MW_prod_FillerV2 / SW_prod_FillerV2 > 0.1 And MW_prod_FillerV2 / SW_prod_FillerV2 < 1 And Tank_SpringwaterV1 <= Tank_MineralwaterV1 Then GoTo V2_Line9 Else GoTo V2_Line10
V2_Line9:
Range("G17").Value = Range("G14").Value * (1)
Range("G18").Value = Range("G14").Value * (0)
GoTo V2_LineEND
V2_Line10:
If MW_prod_FillerV2 / SW_prod_FillerV2 < 1 And MW_prod_FillerV2 / SW_prod_FillerV2 > 0.1 Then GoTo V2_Line11 Else GoTo V2_Line12
V2_Line11:
Range("G17").Value = Range("G14").Value / 2
Range("G18").Value = Range("G14").Value / 2
GoTo V2_LineEND
V2_Line12:
If MW_prod_FillerV2 / SW_prod_FillerV2 > 1 And Tank_SpringwaterV1 >= Tank_MineralwaterV1 Then GoTo V2_Line13
V2_Line13:
Range("G17").Value = Range("G14").Value * (1 / 3)
Range("G18").Value = Range("G14").Value * (2 / 3)
GoTo V2_LineEND
V2_LineEND:
If MW_prod_FillerV3 / SW_prod_FillerV3 > 1 And Tank_SpringwaterV2 < Tank_MineralwaterV2 Then GoTo V3_Line1 Else GoTo V3_Line2
V3_Line1:
Range("H17").Value = Range("H14").Value * (2 / 3)
Range("H18").Value = Range("H14").Value * (1 / 3)
GoTo V3_LineEND
V3_Line2:
If MW_prod_FillerV3 / SW_prod_FillerV3 < 0.1 And MW_prod_FillerV3 / SW_prod_FillerV3 < 1 And Tank_SpringwaterV2 <= Tank_MineralwaterV2 Then GoTo V3_Line3 Else GoTo V3_Line4
V3_Line3:
Range("H17").Value = Range("H14").Value * (1)
Range("H18").Value = Range("H14").Value * (0)
'GoTo V3_LineEND
V3_Line4:
If MW_prod_FillerV3 / SW_prod_FillerV3 < 0.1 And MW_prod_FillerV3 / SW_prod_FillerV3 < 1 And Tank_SpringwaterV2 >= Tank_MineralwaterV2 Then GoTo V3_Line5 Else GoTo V3_Line6
V3_Line5:
Range("H17").Value = Range("H14").Value * (0)
Range("H18").Value = Range("H14").Value * (1)
GoTo V3_LineEND
V3_Line6:
If MW_prod_FillerV3 / SW_prod_FillerV3 > 0.1 And MW_prod_FillerV3 / SW_prod_FillerV3 < 1 And Tank_SpringwaterV2 >= Tank_MineralwaterV2 Then GoTo V3_Line7 Else GoTo V3_Line8
V3_Line7:
Range("H17").Value = Range("H14").Value * (0)
Range("H18").Value = Range("H14").Value * (1)
GoTo V3_LineEND
V3_Line8:
If MW_prod_FillerV3 / SW_prod_FillerV3 > 0.1 And MW_prod_FillerV3 / SW_prod_FillerV3 < 1 And Tank_SpringwaterV2 <= Tank_MineralwaterV2 Then GoTo V3_Line9 Else GoTo V3_Line10
V3_Line9:
Range("H17").Value = Range("H14").Value * (1)
Range("H18").Value = Range("H14").Value * (0)
GoTo V3_LineEND
V3_Line10:
If MW_prod_FillerV3 / SW_prod_FillerV3 < 1 And MW_prod_FillerV3 / SW_prod_FillerV3 > 0.1 Then GoTo V3_Line11 Else GoTo V3_Line12
V3_Line11:
Range("H17").Value = Range("H14").Value / 2
Range("H18").Value = Range("H14").Value / 2
GoTo V3_LineEND
V3_Line12:
If MW_prod_FillerV3 / SW_prod_FillerV3 > 1 And Tank_SpringwaterV2 >= Tank_MineralwaterV2 Then GoTo V3_Line13
V3_Line13:
Range("H17").Value = Range("H14").Value * (1 / 3)
Range("H18").Value = Range("H14").Value * (2 / 3)
GoTo V3_LineEND
V3_LineEND:
If MW_prod_FillerV4 / SW_prod_FillerV4 > 1 And Tank_SpringwaterV3 < Tank_MineralwaterV3 Then GoTo V4_Line1 Else GoTo V4_Line2
V4_Line1:
Range("I17").Value = Range("I14").Value * (2 / 3)
Range("I18").Value = Range("I14").Value * (1 / 3)
GoTo V4_LineEND
V4_Line2:
If MW_prod_FillerV4 / SW_prod_FillerV4 < 0.1 And MW_prod_FillerV4 / SW_prod_FillerV4 < 1 And Tank_SpringwaterV3 <= Tank_MineralwaterV3 Then GoTo V4_Line3 Else GoTo V4_Line4
V4_Line3:
Range("I17").Value = Range("I14").Value * (1)
Range("I18").Value = Range("I14").Value * (0)
GoTo V4_LineEND
V4_Line4:
If MW_prod_FillerV4 / SW_prod_FillerV4 < 0.1 And MW_prod_FillerV4 / SW_prod_FillerV4 < 1 And Tank_SpringwaterV3 >= Tank_MineralwaterV3 Then GoTo V4_Line5 Else GoTo V4_Line6
V4_Line5:
Range("I17").Value = Range("I14").Value * (0)
Range("I18").Value = Range("I14").Value * (1)
GoTo V4_LineEND
V4_Line6:
If MW_prod_FillerV4 / SW_prod_FillerV4 > 0.1 And MW_prod_FillerV4 / SW_prod_FillerV4 < 1 And Tank_SpringwaterV3 >= Tank_MineralwaterV3 Then GoTo V4_Line7 Else GoTo V4_Line8
V4_Line7:
Range("I17").Value = Range("I14").Value * (0)
Range("I18").Value = Range("I14").Value * (1)
GoTo V4_LineEND
V4_Line8:
If MW_prod_FillerV4 / SW_prod_FillerV4 > 0.1 And MW_prod_FillerV4 / SW_prod_FillerV4 < 1 And Tank_SpringwaterV3 <= Tank_MineralwaterV3 Then GoTo V4_Line9 Else GoTo V4_Line10
V4_Line9:
Range("I17").Value = Range("I14").Value * (1)
Range("I18").Value = Range("I14").Value * (0)
GoTo V4_LineEND
V4_Line10:
If MW_prod_FillerV4 / SW_prod_FillerV4 < 1 And MW_prod_FillerV4 / SW_prod_FillerV4 > 0.1 Then GoTo V4_Line11 Else GoTo V4_Line12
V4_Line11:
Range("I17").Value = Range("I14").Value / 2
Range("I18").Value = Range("I14").Value / 2
GoTo V4_LineEND
V4_Line12:
If MW_prod_FillerV4 / SW_prod_FillerV4 > 1 And Tank_SpringwaterV3 >= Tank_MineralwaterV3 Then GoTo V4_Line13
V4_Line13:
Range("I17").Value = Range("I14").Value * (1 / 3)
Range("I18").Value = Range("I14").Value * (2 / 3)
GoTo V4_LineEND
V4_LineEND:
If MW_prod_FillerV5 / SW_prod_FillerV5 > 1 And Tank_SpringwaterV4 < Tank_MineralwaterV4 Then GoTo V5_Line1 Else GoTo V5_Line2
V5_Line1:
Range("J17").Value = Range("J14").Value * (2 / 3)
Range("J18").Value = Range("J14").Value * (1 / 3)
GoTo V5_LineEND
V5_Line2:
If MW_prod_FillerV5 / SW_prod_FillerV5 < 0.1 And MW_prod_FillerV5 / SW_prod_FillerV5 < 1 And Tank_SpringwaterV4 <= Tank_MineralwaterV4 Then GoTo V5_Line3 Else GoTo V5_Line4
V5_Line3:
Range("J17").Value = Range("J14").Value * (1)
Range("J18").Value = Range("J14").Value * (0)
GoTo V5_LineEND
V5_Line4:
If MW_prod_FillerV5 / SW_prod_FillerV5 < 0.1 And MW_prod_FillerV5 / SW_prod_FillerV5 < 1 And Tank_SpringwaterV4 >= Tank_MineralwaterV4 Then GoTo V5_Line5 Else GoTo V5_Line6
V5_Line5:
Range("J17").Value = Range("J14").Value * (0)
Range("J18").Value = Range("J14").Value * (1)
'GoTo V5_LineEND
V5_Line6:
If MW_prod_FillerV5 / SW_prod_FillerV5 > 0.1 And MW_prod_FillerV5 / SW_prod_FillerV5 < 1 And Tank_SpringwaterV4 >= Tank_MineralwaterV4 Then GoTo V5_Line7 Else GoTo V5_Line8
V5_Line7:
Range("J17").Value = Range("J14").Value * (0)
Range("J18").Value = Range("J14").Value * (1)
GoTo V5_LineEND
V5_Line8:
If MW_prod_FillerV5 / SW_prod_FillerV5 > 0.1 And MW_prod_FillerV5 / SW_prod_FillerV5 < 1 And Tank_SpringwaterV4 <= Tank_MineralwaterV4 Then GoTo V5_Line9 Else GoTo V5_Line10
V5_Line9:
Range("J17").Value = Range("J14").Value * (1)
Range("J18").Value = Range("J14").Value * (0)
GoTo V5_LineEND
V5_Line10:
If MW_prod_FillerV5 / SW_prod_FillerV5 < 1 And MW_prod_FillerV5 / SW_prod_FillerV5 > 0.1 Then GoTo V5_Line11 Else GoTo V5_Line12
V5_Line11:
Range("J17").Value = Range("J14").Value / 2
Range("J18").Value = Range("J14").Value / 2
GoTo V5_LineEND
V5_Line12:
If MW_prod_FillerV5 / SW_prod_FillerV5 > 1 And Tank_SpringwaterV4 >= Tank_MineralwaterV4 Then GoTo V5_Line13
V5_Line13:
Range("J17").Value = Range("J14").Value * (1 / 3)
Range("J18").Value = Range("J14").Value * (2 / 3)
GoTo V5_LineEND
V5_LineEND:
If MW_prod_FillerV6 / SW_prod_FillerV6 > 1 And Tank_SpringwaterV5 < Tank_MineralwaterV5 Then GoTo V6_Line1 Else GoTo V6_Line2
V6_Line1:
Range("K17").Value = Range("K14").Value * (2 / 3)
Range("K18").Value = Range("K14").Value * (1 / 3)
GoTo V6_LineEND
V6_Line2:
If MW_prod_FillerV6 / SW_prod_FillerV6 < 0.1 And MW_prod_FillerV6 / SW_prod_FillerV6 < 1 And Tank_SpringwaterV5 <= Tank_MineralwaterV5 Then GoTo V6_Line3 Else GoTo V6_Line4
V6_Line3:
Range("K17").Value = Range("K14").Value * (1)
Range("K18").Value = Range("K14").Value * (0)
GoTo V6_LineEND
V6_Line4:
If MW_prod_FillerV6 / SW_prod_FillerV6 < 0.1 And MW_prod_FillerV6 / SW_prod_FillerV6 < 1 And Tank_SpringwaterV5 >= Tank_MineralwaterV5 Then GoTo V6_Line5 Else GoTo V6_Line6
V6_Line5:
Range("K17").Value = Range("K14").Value * (0)
Range("K18").Value = Range("K14").Value * (1)
GoTo V6_LineEND
V6_Line6:
If MW_prod_FillerV6 / SW_prod_FillerV6 > 0.1 And MW_prod_FillerV6 / SW_prod_FillerV6 < 1 And Tank_SpringwaterV5 >= Tank_MineralwaterV5 Then GoTo V6_Line7 Else GoTo V6_Line8
V6_Line7:
Range("K17").Value = Range("K14").Value * (0)
Range("K18").Value = Range("K14").Value * (1)
GoTo V6_LineEND
V6_Line8:
If MW_prod_FillerV6 / SW_prod_FillerV6 > 0.1 And MW_prod_FillerV6 / SW_prod_FillerV6 < 1 And Tank_SpringwaterV5 <= Tank_MineralwaterV5 Then GoTo V6_Line9 Else GoTo V6_Line10
V6_Line9:
Range("K17").Value = Range("K14").Value * (1)
Range("K18").Value = Range("K14").Value * (0)
GoTo V6_LineEND
V6_Line10:
If MW_prod_FillerV6 / SW_prod_FillerV6 < 1 And MW_prod_FillerV6 / SW_prod_FillerV6 > 0.1 Then GoTo V6_Line11 Else GoTo V6_Line12
V6_Line11:
Range("K17").Value = Range("K14").Value / 2
Range("K18").Value = Range("K14").Value / 2
GoTo V6_LineEND
V6_Line12:
If MW_prod_FillerV6 / SW_prod_FillerV6 > 1 And Tank_SpringwaterV5 > Tank_MineralwaterV5 Then GoTo V6_Line13 Else GoTo V6_LineEND
V6_Line13:
Range("K17").Value = Range("K14").Value * (1 / 3)
Range("K18").Value = Range("K14").Value * (2 / 3)
GoTo V6_LineEND
V6_LineEND:
If MW_prod_FillerV7 / SW_prod_FillerV7 > 1 And Tank_SpringwaterV6 < Tank_MineralwaterV6 Then GoTo V7_Line1 Else GoTo V7_Line2
V7_Line1:
Range("L17").Value = Range("L14").Value * (2 / 3)
Range("L18").Value = Range("L14").Value * (1 / 3)
GoTo V7_LineEND
V7_Line2:
If MW_prod_FillerV7 / SW_prod_FillerV7 < 0.1 And MW_prod_FillerV7 / SW_prod_FillerV7 < 1 And Tank_SpringwaterV6 <= Tank_MineralwaterV6 Then GoTo V7_Line3 Else GoTo V7_Line4
V7_Line3:
Range("L17").Value = Range("L14").Value * (1)
Range("L18").Value = Range("L14").Value * (0)
GoTo V7_LineEND
V7_Line4:
If MW_prod_FillerV7 / SW_prod_FillerV7 < 0.1 And MW_prod_FillerV7 / SW_prod_FillerV7 < 1 And Tank_SpringwaterV6 >= Tank_MineralwaterV6 Then GoTo V7_Line5 Else GoTo V7_Line6
V7_Line5:
Range("L17").Value = Range("L14").Value * (0)
Range("L18").Value = Range("L14").Value * (1)
GoTo V7_LineEND
V7_Line6:
If MW_prod_FillerV7 / SW_prod_FillerV7 > 0.1 And MW_prod_FillerV7 / SW_prod_FillerV7 < 1 And Tank_SpringwaterV6 >= Tank_MineralwaterV6 Then GoTo V7_Line7 Else GoTo V7_Line8
V7_Line7:
Range("L17").Value = Range("L14").Value * (0)
Range("L18").Value = Range("L14").Value * (1)
GoTo V7_LineEND
V7_Line8:
If MW_prod_FillerV7 / SW_prod_FillerV7 > 0.1 And MW_prod_FillerV7 / SW_prod_FillerV7 < 1 And Tank_SpringwaterV6 <= Tank_MineralwaterV6 Then GoTo V7_Line9 Else GoTo V7_Line10
V7_Line9:
Range("L17").Value = Range("L14").Value * (1)
Range("L18").Value = Range("L14").Value * (0)
GoTo V7_LineEND
V7_Line10:
If MW_prod_FillerV7 / SW_prod_FillerV7 < 1 And MW_prod_FillerV7 / SW_prod_FillerV7 > 0.1 Then GoTo V7_Line11 Else GoTo V7_Line12
V7_Line11:
Range("L17").Value = Range("L14").Value / 2
Range("L18").Value = Range("L14").Value / 2
GoTo V7_LineEND
V7_Line12:
If MW_prod_FillerV7 / SW_prod_FillerV7 > 1 And Tank_SpringwaterV6 > Tank_MineralwaterV6 Then GoTo V7_Line13 Else GoTo V7_LineEND
V7_Line13:
Range("L17").Value = Range("L14").Value * (1 / 3)
Range("L18").Value = Range("L14").Value * (2 / 3)
GoTo V7_LineEND
V7_LineEND:
If MW_prod_FillerV8 / SW_prod_FillerV8 > 1 And Tank_SpringwaterV7 < Tank_MineralwaterV7 Then GoTo V8_Line1 Else GoTo V8_Line2
V8_Line1:
Range("M17").Value = Range("M14").Value * (2 / 3)
Range("M18").Value = Range("M14").Value * (1 / 3)
GoTo V8_LineEND
V8_Line2:
If MW_prod_FillerV8 / SW_prod_FillerV8 < 0.1 And MW_prod_FillerV8 / SW_prod_FillerV8 < 1 And Tank_SpringwaterV7 <= Tank_MineralwaterV7 Then GoTo V8_Line3 Else GoTo V8_Line4
V8_Line3:
Range("M17").Value = Range("M14").Value * (1)
Range("M18").Value = Range("M14").Value * (0)
GoTo V8_LineEND
V8_Line4:
If MW_prod_FillerV8 / SW_prod_FillerV8 < 0.1 And MW_prod_FillerV8 / SW_prod_FillerV8 < 1 And Tank_SpringwaterV7 >= Tank_MineralwaterV7 Then GoTo V8_Line5 Else GoTo V8_Line6
V8_Line5:
Range("M17").Value = Range("M14").Value * (0)
Range("M18").Value = Range("M14").Value * (1)
GoTo V8_LineEND
V8_Line6:
If MW_prod_FillerV8 / SW_prod_FillerV8 > 0.1 And MW_prod_FillerV8 / SW_prod_FillerV8 < 1 And Tank_SpringwaterV7 >= Tank_MineralwaterV7 Then GoTo V8_Line7 Else GoTo V8_Line8
V8_Line7:
Range("M17").Value = Range("M14").Value * (0)
Range("M18").Value = Range("M14").Value * (1)
GoTo V8_LineEND
V8_Line8:
If MW_prod_FillerV8 / SW_prod_FillerV8 > 0.1 And MW_prod_FillerV8 / SW_prod_FillerV8 < 1 And Tank_SpringwaterV7 <= Tank_MineralwaterV7 Then GoTo V8_Line9 Else GoTo V8_Line10
V8_Line9:
Range("M17").Value = Range("M14").Value * (1)
Range("M18").Value = Range("M14").Value * (0)
GoTo V8_LineEND
V8_Line10:
If MW_prod_FillerV8 / SW_prod_FillerV8 < 1 And MW_prod_FillerV8 / SW_prod_FillerV8 > 0.1 Then GoTo V8_Line11 Else GoTo V8_Line12
V8_Line11:
Range("M17").Value = Range("M14").Value / 2
Range("M18").Value = Range("M14").Value / 2
GoTo V8_LineEND
V8_Line12:
If MW_prod_FillerV8 / SW_prod_FillerV8 > 1 And Tank_SpringwaterV7 > Tank_MineralwaterV7 Then GoTo V8_Line13 Else GoTo V8_LineEND
V8_Line13:
Range("M17").Value = Range("M14").Value * (1 / 3)
Range("M18").Value = Range("M14").Value * (2 / 3)
GoTo V8_LineEND
V8_LineEND:
'Application.Wait Now + TimeSerial(0, 0, 20) 'wartet 20 Sekunden
If MW_prod_FillerV9 / SW_prod_FillerV9 > 1 And Tank_SpringwaterV8 < Tank_MineralwaterV8 Then GoTo V9_Line1 Else GoTo V9_Line2
V9_Line1:
Range("N17").Value = Range("N14").Value * (2 / 3)
Range("N18").Value = Range("N14").Value * (1 / 3)
GoTo V9_LineEND
V9_Line2:
If MW_prod_FillerV9 / SW_prod_FillerV9 < 0.1 And MW_prod_FillerV9 / SW_prod_FillerV9 < 1 And Tank_SpringwaterV8 <= Tank_MineralwaterV8 Then GoTo V9_Line3 Else GoTo V9_Line4
V9_Line3:
Range("N17").Value = Range("N14").Value * (1)
Range("N18").Value = Range("N14").Value * (0)
GoTo V9_LineEND
V9_Line4:
If MW_prod_FillerV9 / SW_prod_FillerV9 < 0.1 And MW_prod_FillerV9 / SW_prod_FillerV9 < 1 And Tank_SpringwaterV8 >= Tank_MineralwaterV8 Then GoTo V9_Line5 Else GoTo V9_Line6
V9_Line5:
Range("N17").Value = Range("N14").Value * (0)
Range("N18").Value = Range("N14").Value * (1)
GoTo V9_LineEND
V9_Line6:
If MW_prod_FillerV9 / SW_prod_FillerV9 > 0.1 And MW_prod_FillerV9 / SW_prod_FillerV9 < 1 And Tank_SpringwaterV8 >= Tank_MineralwaterV8 Then GoTo V9_Line7 Else GoTo V9_Line8
V9_Line7:
Range("N17").Value = Range("N14").Value * (0)
Range("N18").Value = Range("N14").Value * (1)
GoTo V9_LineEND
V9_Line8:
If MW_prod_FillerV9 / SW_prod_FillerV9 > 0.1 And MW_prod_FillerV9 / SW_prod_FillerV9 < 1 And Tank_SpringwaterV8 <= Tank_MineralwaterV8 Then GoTo V9_Line9 Else GoTo V9_Line10
V9_Line9:
Range("N17").Value = Range("N14").Value * (1)
Range("N18").Value = Range("N14").Value * (0)
GoTo V9_LineEND
V9_Line10:
If MW_prod_FillerV9 / SW_prod_FillerV9 < 1 And MW_prod_FillerV9 / SW_prod_FillerV9 > 0.1 Then GoTo V9_Line11 Else GoTo V9_Line12
V9_Line11:
Range("N17").Value = Range("N14").Value / 2
Range("N18").Value = Range("N14").Value / 2
GoTo V9_LineEND
V9_Line12:
If MW_prod_FillerV9 / SW_prod_FillerV9 > 1 And Tank_SpringwaterV8 > Tank_MineralwaterV8 Then GoTo V9_Line13 Else GoTo V9_LineEND
V9_Line13:
Range("N17").Value = Range("N14").Value * (1 / 3)
Range("N18").Value = Range("N14").Value * (2 / 3)
GoTo V9_LineEND
V9_LineEND:
If MW_prod_FillerV10 / SW_prod_FillerV10 > 1 And Tank_SpringwaterV9 < Tank_MineralwaterV9 Then GoTo V10_Line1 Else GoTo V10_Line2
V10_Line1:
Range("O17").Value = Range("O14").Value * (2 / 3)
Range("O18").Value = Range("O14").Value * (1 / 3)
GoTo V10_LineEND
V10_Line2:
If MW_prod_FillerV10 / SW_prod_FillerV10 < 0.1 And MW_prod_FillerV10 / SW_prod_FillerV10 < 1 And Tank_SpringwaterV9 <= Tank_MineralwaterV9 Then GoTo V10_Line3 Else GoTo V10_Line4
V10_Line3:
Range("O17").Value = Range("O14").Value * (1)
Range("O18").Value = Range("O14").Value * (0)
GoTo V10_LineEND
V10_Line4:
If MW_prod_FillerV10 / SW_prod_FillerV10 < 0.1 And MW_prod_FillerV10 / SW_prod_FillerV10 < 1 And Tank_SpringwaterV9 >= Tank_MineralwaterV9 Then GoTo V10_Line5 Else GoTo V10_Line6
V10_Line5:
Range("O17").Value = Range("O14").Value * (0)
Range("O18").Value = Range("O14").Value * (1)
GoTo V10_LineEND
V10_Line6:
If MW_prod_FillerV10 / SW_prod_FillerV10 > 0.1 And MW_prod_FillerV10 / SW_prod_FillerV10 < 1 And Tank_SpringwaterV9 >= Tank_MineralwaterV9 Then GoTo V10_Line7 Else GoTo V10_Line8
V10_Line7:
Range("O17").Value = Range("O14").Value * (0)
Range("O18").Value = Range("O14").Value * (1)
GoTo V10_LineEND
V10_Line8:
If MW_prod_FillerV10 / SW_prod_FillerV10 > 0.1 And MW_prod_FillerV10 / SW_prod_FillerV10 < 1 And Tank_SpringwaterV9 <= Tank_MineralwaterV9 Then GoTo V10_Line9 Else GoTo V10_Line10
V10_Line9:
Range("O17").Value = Range("O14").Value * (1)
Range("O18").Value = Range("O14").Value * (0)
GoTo V10_LineEND
V10_Line10:
If MW_prod_FillerV10 / SW_prod_FillerV10 < 1 And MW_prod_FillerV10 / SW_prod_FillerV10 > 0.1 Then GoTo V10_Line11 Else GoTo V10_Line12
V10_Line11:
Range("O17").Value = Range("O14").Value / 2
Range("O18").Value = Range("O14").Value / 2
GoTo V10_LineEND
V10_Line12:
If MW_prod_FillerV10 / SW_prod_FillerV10 > 1 And Tank_SpringwaterV9 > Tank_MineralwaterV9 Then GoTo V10_Line13 Else GoTo V10_LineEND
V10_Line13:
Range("O17").Value = Range("O14").Value * (1 / 3)
Range("O18").Value = Range("O14").Value * (2 / 3)
GoTo V10_LineEND
V10_LineEND:
If MW_prod_FillerV11 / SW_prod_FillerV11 > 1 And Tank_SpringwaterV10 < Tank_MineralwaterV10 Then GoTo V11_Line1 Else GoTo V11_Line2
V11_Line1:
Range("P17").Value = Range("P14").Value * (2 / 3)
Range("P18").Value = Range("P14").Value * (1 / 3)
GoTo V11_LineEND
V11_Line2:
If MW_prod_FillerV11 / SW_prod_FillerV11 < 0.1 And MW_prod_FillerV11 / SW_prod_FillerV11 < 1 And Tank_SpringwaterV10 <= Tank_MineralwaterV10 Then GoTo V11_Line3 Else GoTo V11_Line4
V11_Line3:
Range("P17").Value = Range("P14").Value * (1)
Range("P18").Value = Range("P14").Value * (0)
GoTo V11_LineEND
V11_Line4:
If MW_prod_FillerV11 / SW_prod_FillerV11 < 0.1 And MW_prod_FillerV11 / SW_prod_FillerV11 < 1 And Tank_SpringwaterV10 >= Tank_MineralwaterV10 Then GoTo V11_Line5 Else GoTo V11_Line6
V11_Line5:
Range("P17").Value = Range("P14").Value * (0)
Range("P18").Value = Range("P14").Value * (1)
GoTo V11_LineEND
V11_Line6:
If MW_prod_FillerV11 / SW_prod_FillerV11 > 0.1 And MW_prod_FillerV11 / SW_prod_FillerV11 < 1 And Tank_SpringwaterV10 >= Tank_MineralwaterV10 Then GoTo V11_Line7 Else GoTo V11_Line8
V11_Line7:
Range("P17").Value = Range("P14").Value * (0)
Range("P18").Value = Range("P14").Value * (1)
GoTo V11_LineEND
V11_Line8:
If MW_prod_FillerV11 / SW_prod_FillerV11 > 0.1 And MW_prod_FillerV11 / SW_prod_FillerV11 < 1 And Tank_SpringwaterV10 <= Tank_MineralwaterV10 Then GoTo V11_Line9 Else GoTo V11_Line10
V11_Line9:
Range("P17").Value = Range("P14").Value * (1)
Range("P18").Value = Range("P14").Value * (0)
GoTo V11_LineEND
V11_Line10:
If MW_prod_FillerV11 / SW_prod_FillerV11 < 1 And MW_prod_FillerV11 / SW_prod_FillerV11 > 0.1 Then GoTo V11_Line11 Else GoTo V11_Line12
V11_Line11:
Range("P17").Value = Range("P14").Value / 2
Range("P18").Value = Range("P14").Value / 2
GoTo V11_LineEND
V11_Line12:
If MW_prod_FillerV11 / SW_prod_FillerV11 > 1 And Tank_SpringwaterV10 > Tank_MineralwaterV10 Then GoTo V11_Line13 Else GoTo V11_LineEND
V11_Line13:
Range("P17").Value = Range("P14").Value * (1 / 3)
Range("P18").Value = Range("P14").Value * (2 / 3)
GoTo V11_LineEND
V11_LineEND:
If MW_prod_FillerV12 / SW_prod_FillerV12 > 1 And Tank_SpringwaterV11 < Tank_MineralwaterV11 Then GoTo V12_Line1 Else GoTo V12_Line2
V12_Line1:
Range("Q17").Value = Range("Q14").Value * (2 / 3)
Range("Q18").Value = Range("Q14").Value * (1 / 3)
GoTo V12_LineEND
V12_Line2:
If MW_prod_FillerV12 / SW_prod_FillerV12 < 0.1 And MW_prod_FillerV12 / SW_prod_FillerV12 < 1 And Tank_SpringwaterV11 <= Tank_MineralwaterV11 Then GoTo V12_Line3 Else GoTo V12_Line4
V12_Line3:
Range("Q17").Value = Range("Q14").Value * (1)
Range("Q18").Value = Range("Q14").Value * (0)
GoTo V12_LineEND
V12_Line4:
If MW_prod_FillerV12 / SW_prod_FillerV12 < 0.1 And MW_prod_FillerV12 / SW_prod_FillerV12 < 1 And Tank_SpringwaterV11 >= Tank_MineralwaterV11 Then GoTo V12_Line5 Else GoTo V12_Line6
V12_Line5:
Range("Q17").Value = Range("Q14").Value * (0)
Range("Q18").Value = Range("Q14").Value * (1)
GoTo V12_LineEND
V12_Line6:
If MW_prod_FillerV12 / SW_prod_FillerV12 > 0.1 And MW_prod_FillerV12 / SW_prod_FillerV12 < 1 And Tank_SpringwaterV11 >= Tank_MineralwaterV11 Then GoTo V12_Line7 Else GoTo V12_Line8
V12_Line7:
Range("Q17").Value = Range("Q14").Value * (0)
Range("Q18").Value = Range("Q14").Value * (1)
GoTo V12_LineEND
V12_Line8:
If MW_prod_FillerV12 / SW_prod_FillerV12 > 0.1 And MW_prod_FillerV12 / SW_prod_FillerV12 < 1 And Tank_SpringwaterV11 <= Tank_MineralwaterV11 Then GoTo V12_Line9 Else GoTo V12_Line10
V12_Line9:
Range("Q17").Value = Range("Q14").Value * (1)
Range("Q18").Value = Range("Q14").Value * (0)
GoTo V12_LineEND
V12_Line10:
If MW_prod_FillerV12 / SW_prod_FillerV12 < 1 And MW_prod_FillerV12 / SW_prod_FillerV12 > 0.1 Then GoTo V12_Line11 Else GoTo V12_Line12
V12_Line11:
Range("Q17").Value = Range("Q14").Value / 2
Range("Q18").Value = Range("Q14").Value / 2
GoTo V12_LineEND
V12_Line12:
If MW_prod_FillerV12 / SW_prod_FillerV12 > 1 And Tank_SpringwaterV11 > Tank_MineralwaterV11 Then GoTo V12_Line13 Else GoTo V12_LineEND
V12_Line13:
Range("Q17").Value = Range("Q14").Value * (1 / 3)
Range("Q18").Value = Range("Q14").Value * (2 / 3)
GoTo V12_LineEND
V12_LineEND:
If MW_prod_FillerV13 / SW_prod_FillerV13 > 1 And Tank_SpringwaterV12 < Tank_MineralwaterV12 Then GoTo V13_Line1 Else GoTo V13_Line2
V13_Line1:
Range("R17").Value = Range("R14").Value * (2 / 3)
Range("R18").Value = Range("R14").Value * (1 / 3)
GoTo V13_LineEND
V13_Line2:
If MW_prod_FillerV13 / SW_prod_FillerV13 < 0.1 And MW_prod_FillerV13 / SW_prod_FillerV13 < 1 And Tank_SpringwaterV12 <= Tank_MineralwaterV12 Then GoTo V13_Line3 Else GoTo V13_Line4
V13_Line3:
Range("R17").Value = Range("R14").Value * (1)
Range("R18").Value = Range("R14").Value * (0)
GoTo V13_LineEND
V13_Line4:
If MW_prod_FillerV13 / SW_prod_FillerV13 < 0.1 And MW_prod_FillerV13 / SW_prod_FillerV13 < 1 And Tank_SpringwaterV12 >= Tank_MineralwaterV12 Then GoTo V13_Line5 Else GoTo V13_Line6
V13_Line5:
Range("R17").Value = Range("R14").Value * (0)
Range("R18").Value = Range("R14").Value * (1)
GoTo V13_LineEND
V13_Line6:
If MW_prod_FillerV13 / SW_prod_FillerV13 > 0.1 And MW_prod_FillerV13 / SW_prod_FillerV13 < 1 And Tank_SpringwaterV12 >= Tank_MineralwaterV12 Then GoTo V13_Line7 Else GoTo V13_Line8
V13_Line7:
Range("R17").Value = Range("R14").Value * (0)
Range("R18").Value = Range("R14").Value * (1)
GoTo V13_LineEND
V13_Line8:
If MW_prod_FillerV13 / SW_prod_FillerV13 > 0.1 And MW_prod_FillerV13 / SW_prod_FillerV13 < 1 And Tank_SpringwaterV12 <= Tank_MineralwaterV12 Then GoTo V13_Line9 Else GoTo V13_Line10
V13_Line9:
Range("R17").Value = Range("R14").Value * (1)
Range("R18").Value = Range("R14").Value * (0)
GoTo V13_LineEND
V13_Line10:
If MW_prod_FillerV13 / SW_prod_FillerV13 < 1 And MW_prod_FillerV13 / SW_prod_FillerV13 > 0.1 Then GoTo V13_Line11 Else GoTo V13_Line12
V13_Line11:
Range("R17").Value = Range("R14").Value / 2
Range("R18").Value = Range("R14").Value / 2
GoTo V13_LineEND
V13_Line12:
If MW_prod_FillerV13 / SW_prod_FillerV13 > 1 And Tank_SpringwaterV12 > Tank_MineralwaterV12 Then GoTo V13_Line13 Else GoTo V13_LineEND
V13_Line13:
Range("R17").Value = Range("R14").Value * (1 / 3)
Range("R18").Value = Range("R14").Value * (2 / 3)
GoTo V13_LineEND
V13_LineEND:
If MW_prod_FillerV14 / SW_prod_FillerV14 > 1 And Tank_SpringwaterV13 < Tank_MineralwaterV13 Then GoTo V14_Line1 Else GoTo V14_Line2
V14_Line1:
Range("S17").Value = Range("S14").Value * (2 / 3)
Range("S18").Value = Range("S14").Value * (1 / 3)
GoTo V14_LineEND
V14_Line2:
If MW_prod_FillerV14 / SW_prod_FillerV14 < 0.1 And MW_prod_FillerV14 / SW_prod_FillerV14 < 1 And Tank_SpringwaterV13 <= Tank_MineralwaterV13 Then GoTo V14_Line3 Else GoTo V14_Line4
V14_Line3:
Range("S17").Value = Range("S14").Value * (1)
Range("S18").Value = Range("S14").Value * (0)
GoTo V14_LineEND
V14_Line4:
If MW_prod_FillerV14 / SW_prod_FillerV14 < 0.1 And MW_prod_FillerV14 / SW_prod_FillerV14 < 1 And Tank_SpringwaterV13 >= Tank_MineralwaterV13 Then GoTo V14_Line5 Else GoTo V14_Line6
V14_Line5:
Range("S17").Value = Range("S14").Value * (0)
Range("S18").Value = Range("S14").Value * (1)
GoTo V14_LineEND
V14_Line6:
If MW_prod_FillerV14 / SW_prod_FillerV14 > 0.1 And MW_prod_FillerV14 / SW_prod_FillerV14 < 1 And Tank_SpringwaterV13 >= Tank_MineralwaterV13 Then GoTo V14_Line7 Else GoTo V14_Line8
V14_Line7:
Range("S17").Value = Range("S14").Value * (0)
Range("S18").Value = Range("S14").Value * (1)
GoTo V14_LineEND
V14_Line8:
If MW_prod_FillerV14 / SW_prod_FillerV14 > 0.1 And MW_prod_FillerV14 / SW_prod_FillerV14 < 1 And Tank_SpringwaterV13 <= Tank_MineralwaterV13 Then GoTo V14_Line9 Else GoTo V14_Line10
V14_Line9:
Range("S17").Value = Range("S14").Value * (1)
Range("S18").Value = Range("S14").Value * (0)
GoTo V14_LineEND
V14_Line10:
If MW_prod_FillerV14 / SW_prod_FillerV14 < 1 And MW_prod_FillerV14 / SW_prod_FillerV14 > 0.1 Then GoTo V14_Line11 Else GoTo V14_Line12
V14_Line11:
Range("S17").Value = Range("S14").Value / 2
Range("S18").Value = Range("S14").Value / 2
GoTo V14_LineEND
V14_Line12:
If MW_prod_FillerV14 / SW_prod_FillerV14 > 1 And Tank_SpringwaterV13 > Tank_MineralwaterV13 Then GoTo V14_Line13 Else GoTo V14_LineEND
V14_Line13:
Range("S17").Value = Range("S14").Value * (1 / 3)
Range("S18").Value = Range("S14").Value * (2 / 3)
GoTo V14_LineEND
V14_LineEND:
If MW_prod_FillerV15 / SW_prod_FillerV15 > 1 And Tank_SpringwaterV14 < Tank_MineralwaterV14 Then GoTo V15_Line1 Else GoTo V15_Line2
V15_Line1:
Range("T17").Value = Range("T14").Value * (2 / 3)
Range("T18").Value = Range("T14").Value * (1 / 3)
GoTo V15_LineEND
V15_Line2:
If MW_prod_FillerV15 / SW_prod_FillerV15 < 0.1 And MW_prod_FillerV15 / SW_prod_FillerV15 < 1 And Tank_SpringwaterV14 <= Tank_MineralwaterV14 Then GoTo V15_Line3 Else GoTo V15_Line4
V15_Line3:
Range("T17").Value = Range("T14").Value * (1)
Range("T18").Value = Range("T14").Value * (0)
GoTo V15_LineEND
V15_Line4:
If MW_prod_FillerV15 / SW_prod_FillerV15 < 0.1 And MW_prod_FillerV15 / SW_prod_FillerV15 < 1 And Tank_SpringwaterV14 >= Tank_MineralwaterV14 Then GoTo V15_Line5 Else GoTo V15_Line6
V15_Line5:
Range("T17").Value = Range("T14").Value * (0)
Range("T18").Value = Range("T14").Value * (1)
GoTo V15_LineEND
V15_Line6:
If MW_prod_FillerV15 / SW_prod_FillerV15 > 0.1 And MW_prod_FillerV15 / SW_prod_FillerV15 < 1 And Tank_SpringwaterV14 >= Tank_MineralwaterV14 Then GoTo V15_Line7 Else GoTo V15_Line8
V15_Line7:
Range("T17").Value = Range("T14").Value * (0)
Range("T18").Value = Range("T14").Value * (1)
GoTo V15_LineEND
V15_Line8:
If MW_prod_FillerV15 / SW_prod_FillerV15 > 0.1 And MW_prod_FillerV15 / SW_prod_FillerV15 < 1 And Tank_SpringwaterV14 <= Tank_MineralwaterV14 Then GoTo V15_Line9 Else GoTo V15_Line10
V15_Line9:
Range("T17").Value = Range("T14").Value * (1)
Range("T18").Value = Range("T14").Value * (0)
GoTo V15_LineEND
V15_Line10:
If MW_prod_FillerV15 / SW_prod_FillerV15 < 1 And MW_prod_FillerV15 / SW_prod_FillerV15 > 0.1 Then GoTo V15_Line11 Else GoTo V15_Line12
V15_Line11:
Range("T17").Value = Range("T14").Value / 2
Range("T18").Value = Range("T14").Value / 2
GoTo V15_LineEND
V15_Line12:
If MW_prod_FillerV15 / SW_prod_FillerV15 > 1 And Tank_SpringwaterV14 > Tank_MineralwaterV14 Then GoTo V15_Line13 Else GoTo V15_LineEND
V15_Line13:
Range("T17").Value = Range("T14").Value * (1 / 3)
Range("T18").Value = Range("T14").Value * (2 / 3)
GoTo V15_LineEND
V15_LineEND:
If MW_prod_FillerV16 / SW_prod_FillerV16 > 1 And Tank_SpringwaterV15 < Tank_MineralwaterV15 Then GoTo V16_Line1 Else GoTo V16_Line2
V16_Line1:
Range("U17").Value = Range("U14").Value * (2 / 3)
Range("U18").Value = Range("U14").Value * (1 / 3)
GoTo V16_LineEND
V16_Line2:
If MW_prod_FillerV16 / SW_prod_FillerV16 < 0.1 And MW_prod_FillerV16 / SW_prod_FillerV16 < 1 And Tank_SpringwaterV15 <= Tank_MineralwaterV15 Then GoTo V16_Line3 Else GoTo V16_Line4
V16_Line3:
Range("U17").Value = Range("U14").Value * (1)
Range("U18").Value = Range("U14").Value * (0)
GoTo V16_LineEND
V16_Line4:
If MW_prod_FillerV16 / SW_prod_FillerV16 < 0.1 And MW_prod_FillerV16 / SW_prod_FillerV16 < 1 And Tank_SpringwaterV15 >= Tank_MineralwaterV15 Then GoTo V16_Line5 Else GoTo V16_Line6
V16_Line5:
Range("U17").Value = Range("U14").Value * (0)
Range("U18").Value = Range("U14").Value * (1)
GoTo V16_LineEND
V16_Line6:
If MW_prod_FillerV16 / SW_prod_FillerV16 > 0.1 And MW_prod_FillerV16 / SW_prod_FillerV16 < 1 And Tank_SpringwaterV15 >= Tank_MineralwaterV15 Then GoTo V16_Line7 Else GoTo V16_Line8
V16_Line7:
Range("U17").Value = Range("U14").Value * (0)
Range("U18").Value = Range("U14").Value * (1)
GoTo V16_LineEND
V16_Line8:
If MW_prod_FillerV16 / SW_prod_FillerV16 > 0.1 And MW_prod_FillerV16 / SW_prod_FillerV16 < 1 And Tank_SpringwaterV15 <= Tank_MineralwaterV15 Then GoTo V16_Line9 Else GoTo V16_Line10
V16_Line9:
Range("U17").Value = Range("U14").Value * (1)
Range("U18").Value = Range("U14").Value * (0)
GoTo V16_LineEND
V16_Line10:
If MW_prod_FillerV16 / SW_prod_FillerV16 < 1 And MW_prod_FillerV16 / SW_prod_FillerV16 > 0.1 Then GoTo V16_Line11 Else GoTo V16_Line12
V16_Line11:
Range("U17").Value = Range("U14").Value / 2
Range("U18").Value = Range("U14").Value / 2
GoTo V16_LineEND
V16_Line12:
If MW_prod_FillerV16 / SW_prod_FillerV16 > 1 And Tank_SpringwaterV15 > Tank_MineralwaterV15 Then GoTo V16_Line13 Else GoTo V16_LineEND
V16_Line13:
Range("U17").Value = Range("U14").Value * (1 / 3)
Range("U18").Value = Range("U14").Value * (2 / 3)
GoTo V16_LineEND
V16_LineEND:
If MW_prod_FillerV17 / SW_prod_FillerV17 > 1 And Tank_SpringwaterV16 < Tank_MineralwaterV16 Then GoTo V17_Line1 Else GoTo V17_Line2
V17_Line1:
Range("V17").Value = Range("V14").Value * (2 / 3)
Range("V18").Value = Range("V14").Value * (1 / 3)
GoTo V17_LineEND
V17_Line2:
If MW_prod_FillerV17 / SW_prod_FillerV17 < 0.1 And MW_prod_FillerV17 / SW_prod_FillerV17 < 1 And Tank_SpringwaterV16 <= Tank_MineralwaterV16 Then GoTo V17_Line3 Else GoTo V17_Line4
V17_Line3:
Range("V17").Value = Range("V14").Value * (1)
Range("V18").Value = Range("V14").Value * (0)
GoTo V17_LineEND
V17_Line4:
If MW_prod_FillerV17 / SW_prod_FillerV17 < 0.1 And MW_prod_FillerV17 / SW_prod_FillerV17 < 1 And Tank_SpringwaterV16 >= Tank_MineralwaterV16 Then GoTo V17_Line5 Else GoTo V17_Line6
V17_Line5:
Range("V17").Value = Range("V14").Value * (0)
Range("V18").Value = Range("V14").Value * (1)
GoTo V17_LineEND
V17_Line6:
If MW_prod_FillerV17 / SW_prod_FillerV17 > 0.1 And MW_prod_FillerV17 / SW_prod_FillerV17 < 1 And Tank_SpringwaterV16 >= Tank_MineralwaterV16 Then GoTo V17_Line7 Else GoTo V17_Line8
V17_Line7:
Range("V17").Value = Range("V14").Value * (0)
Range("V18").Value = Range("V14").Value * (1)
GoTo V17_LineEND
V17_Line8:
If MW_prod_FillerV17 / SW_prod_FillerV17 > 0.1 And MW_prod_FillerV17 / SW_prod_FillerV17 < 1 And Tank_SpringwaterV16 <= Tank_MineralwaterV16 Then GoTo V17_Line9 Else GoTo V17_Line10
V17_Line9:
Range("V17").Value = Range("V14").Value * (1)
Range("V18").Value = Range("V14").Value * (0)
GoTo V17_LineEND
V17_Line10:
If MW_prod_FillerV17 / SW_prod_FillerV17 < 1 And MW_prod_FillerV17 / SW_prod_FillerV17 > 0.1 Then GoTo V17_Line11 Else GoTo V17_Line12
V17_Line11:
Range("V17").Value = Range("V14").Value / 2
Range("V18").Value = Range("V14").Value / 2
GoTo V17_LineEND
V17_Line12:
If MW_prod_FillerV17 / SW_prod_FillerV17 > 1 And Tank_SpringwaterV16 > Tank_MineralwaterV16 Then GoTo V17_Line13 Else GoTo V17_LineEND
V17_Line13:
Range("V17").Value = Range("V14").Value * (1 / 3)
Range("V18").Value = Range("V14").Value * (2 / 3)
GoTo V17_LineEND
V17_LineEND:
If MW_prod_FillerV18 / SW_prod_FillerV18 > 1 And Tank_SpringwaterV17 < Tank_MineralwaterV17 Then GoTo V18_Line1 Else GoTo V18_Line2
V18_Line1:
Range("W17").Value = Range("W14").Value * (2 / 3)
Range("W18").Value = Range("W14").Value * (1 / 3)
GoTo V18_LineEND
V18_Line2:
If MW_prod_FillerV18 / SW_prod_FillerV18 < 0.1 And MW_prod_FillerV18 / SW_prod_FillerV18 < 1 And Tank_SpringwaterV17 <= Tank_MineralwaterV17 Then GoTo V18_Line3 Else GoTo V18_Line4
V18_Line3:
Range("W17").Value = Range("W14").Value * (1)
Range("W18").Value = Range("W14").Value * (0)
GoTo V18_LineEND
V18_Line4:
If MW_prod_FillerV18 / SW_prod_FillerV18 < 0.1 And MW_prod_FillerV18 / SW_prod_FillerV18 < 1 And Tank_SpringwaterV17 >= Tank_MineralwaterV17 Then GoTo V18_Line5 Else GoTo V18_Line6
V18_Line5:
Range("W17").Value = Range("W14").Value * (0)
Range("W18").Value = Range("W14").Value * (1)
GoTo V18_LineEND
V18_Line6:
If MW_prod_FillerV18 / SW_prod_FillerV18 > 0.1 And MW_prod_FillerV18 / SW_prod_FillerV18 < 1 And Tank_SpringwaterV17 >= Tank_MineralwaterV17 Then GoTo V18_Line7 Else GoTo V18_Line8
V18_Line7:
Range("W17").Value = Range("W14").Value * (0)
Range("W18").Value = Range("W14").Value * (1)
GoTo V18_LineEND
V18_Line8:
If MW_prod_FillerV18 / SW_prod_FillerV18 > 0.1 And MW_prod_FillerV18 / SW_prod_FillerV18 < 1 And Tank_SpringwaterV17 <= Tank_MineralwaterV17 Then GoTo V18_Line9 Else GoTo V18_Line10
V18_Line9:
Range("W17").Value = Range("W14").Value * (1)
Range("W18").Value = Range("W14").Value * (0)
GoTo V18_LineEND
V18_Line10:
If MW_prod_FillerV18 / SW_prod_FillerV18 < 1 And MW_prod_FillerV18 / SW_prod_FillerV18 > 0.1 Then GoTo V18_Line11 Else GoTo V18_Line12
V18_Line11:
Range("W17").Value = Range("W14").Value / 2
Range("W18").Value = Range("W14").Value / 2
GoTo V18_LineEND
V18_Line12:
If MW_prod_FillerV18 / SW_prod_FillerV18 > 1 And Tank_SpringwaterV17 > Tank_MineralwaterV17 Then GoTo V18_Line13 Else GoTo V18_LineEND
V18_Line13:
Range("W17").Value = Range("W14").Value * (1 / 3)
Range("W18").Value = Range("W14").Value * (2 / 3)
GoTo V18_LineEND
V18_LineEND:
If MW_prod_FillerV19 / SW_prod_FillerV19 > 1 And Tank_SpringwaterV18 < Tank_MineralwaterV18 Then GoTo V19_Line1 Else GoTo V19_Line2
V19_Line1:
Range("X17").Value = Range("X14").Value * (2 / 3)
Range("X18").Value = Range("X14").Value * (1 / 3)
GoTo V19_LineEND
V19_Line2:
If MW_prod_FillerV19 / SW_prod_FillerV19 < 0.1 And MW_prod_FillerV19 / SW_prod_FillerV19 < 1 And Tank_SpringwaterV18 <= Tank_MineralwaterV18 Then GoTo V19_Line3 Else GoTo V19_Line4
V19_Line3:
Range("X17").Value = Range("X14").Value * (1)
Range("X18").Value = Range("X14").Value * (0)
GoTo V19_LineEND
V19_Line4:
If MW_prod_FillerV19 / SW_prod_FillerV19 < 0.1 And MW_prod_FillerV19 / SW_prod_FillerV19 < 1 And Tank_SpringwaterV18 >= Tank_MineralwaterV18 Then GoTo V19_Line5 Else GoTo V19_Line6
V19_Line5:
Range("X17").Value = Range("X14").Value * (0)
Range("X18").Value = Range("X14").Value * (1)
GoTo V19_LineEND
V19_Line6:
If MW_prod_FillerV19 / SW_prod_FillerV19 > 0.1 And MW_prod_FillerV19 / SW_prod_FillerV19 < 1 And Tank_SpringwaterV18 >= Tank_MineralwaterV18 Then GoTo V19_Line7 Else GoTo V19_Line8
V19_Line7:
Range("X17").Value = Range("X14").Value * (0)
Range("X18").Value = Range("X14").Value * (1)
GoTo V19_LineEND
V19_Line8:
If MW_prod_FillerV19 / SW_prod_FillerV19 > 0.1 And MW_prod_FillerV19 / SW_prod_FillerV19 < 1 And Tank_SpringwaterV18 <= Tank_MineralwaterV18 Then GoTo V19_Line9 Else GoTo V19_Line10
V19_Line9:
Range("X17").Value = Range("X14").Value * (1)
Range("X18").Value = Range("X14").Value * (0)
GoTo V19_LineEND
V19_Line10:
If MW_prod_FillerV19 / SW_prod_FillerV19 < 1 And MW_prod_FillerV19 / SW_prod_FillerV19 > 0.1 Then GoTo V19_Line11 Else GoTo V19_Line12
V19_Line11:
Range("X17").Value = Range("X14").Value / 2
Range("X18").Value = Range("X14").Value / 2
GoTo V19_LineEND
V19_Line12:
If MW_prod_FillerV19 / SW_prod_FillerV19 > 1 And Tank_SpringwaterV18 > Tank_MineralwaterV18 Then GoTo V19_Line13 Else GoTo V19_LineEND
V19_Line13:
Range("X17").Value = Range("X14").Value * (1 / 3)
Range("X18").Value = Range("X14").Value * (2 / 3)
GoTo V19_LineEND
V19_LineEND:
If MW_prod_FillerV20 / SW_prod_FillerV20 > 1 And Tank_SpringwaterV19 < Tank_MineralwaterV19 Then GoTo V20_Line1 Else GoTo V20_Line2
V20_Line1:
Range("Y17").Value = Range("Y14").Value * (2 / 3)
Range("Y18").Value = Range("Y14").Value * (1 / 3)
GoTo V20_LineEND
V20_Line2:
If MW_prod_FillerV20 / SW_prod_FillerV20 < 0.1 And MW_prod_FillerV20 / SW_prod_FillerV20 < 1 And Tank_SpringwaterV19 <= Tank_MineralwaterV19 Then GoTo V20_Line3 Else GoTo V20_Line4
V20_Line3:
Range("Y17").Value = Range("Y14").Value * (1)
Range("Y18").Value = Range("Y14").Value * (0)
GoTo V20_LineEND
V20_Line4:
If MW_prod_FillerV20 / SW_prod_FillerV20 < 0.1 And MW_prod_FillerV20 / SW_prod_FillerV20 < 1 And Tank_SpringwaterV19 >= Tank_MineralwaterV19 Then GoTo V20_Line5 Else GoTo V20_Line6
V20_Line5:
Range("Y17").Value = Range("Y14").Value * (0)
Range("Y18").Value = Range("Y14").Value * (1)
GoTo V20_LineEND
V20_Line6:
If MW_prod_FillerV20 / SW_prod_FillerV20 > 0.1 And MW_prod_FillerV20 / SW_prod_FillerV20 < 1 And Tank_SpringwaterV19 >= Tank_MineralwaterV19 Then GoTo V20_Line7 Else GoTo V20_Line8
V20_Line7:
Range("Y17").Value = Range("Y14").Value * (0)
Range("Y18").Value = Range("Y14").Value * (1)
GoTo V20_LineEND
V20_Line8:
If MW_prod_FillerV20 / SW_prod_FillerV20 > 0.1 And MW_prod_FillerV20 / SW_prod_FillerV20 < 1 And Tank_SpringwaterV19 <= Tank_MineralwaterV19 Then GoTo V20_Line9 Else GoTo V20_Line10
V20_Line9:
Range("Y17").Value = Range("Y14").Value * (1)
Range("Y18").Value = Range("Y14").Value * (0)
GoTo V20_LineEND
V20_Line10:
If MW_prod_FillerV20 / SW_prod_FillerV20 < 1 And MW_prod_FillerV20 / SW_prod_FillerV20 > 0.1 Then GoTo V20_Line11 Else GoTo V20_Line12
V20_Line11:
Range("Y17").Value = Range("Y14").Value / 2
Range("Y18").Value = Range("Y14").Value / 2
GoTo V20_LineEND
V20_Line12:
If MW_prod_FillerV20 / SW_prod_FillerV20 > 1 And Tank_SpringwaterV19 > Tank_MineralwaterV19 Then GoTo V20_Line13 Else GoTo V20_LineEND
V20_Line13:
Range("Y17").Value = Range("Y14").Value * (1 / 3)
Range("Y18").Value = Range("Y14").Value * (2 / 3)
GoTo V20_LineEND
V20_LineEND:
'*************************************************************
End Sub

42
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
Es ist weder ein VBA- noch Excel-Problem
11.06.2021 16:44:24
Yal
Hallo Markus,
es ist eine reine Logik- und vor allem Übersicht-Problem. Ich glaube nicht, dass Du jemanden findet, der dein Spaghetti-Code auseinander nehmen wird.
Eigentlich betrifft
V1 die Spalte F,
V2 die Spalte G,
V3 die Spalte H,
usw.
Wenn V1 bis V8 stimmen, hast Du ein Fehler beim Copy-Paste gemacht. Übliche Spaghetti-Code Problem. Die Lösung heisst Refaktorisierung, Kapitel vermeidung von Redundanz.
Aber weil Sudoku irgendwann zu langweilig ist, nehme ich vielleicht heute abend Zeit dafür.
VG
Yal
AW: VBA
11.06.2021 17:01:37
Herbert_Grom
Hallo Markus,
ohne Besispielarbeitsmappe wird das nix. Da musst du dir schon die Mühe machen, diese so weit zu Verkleinern, dass sie unter 300 kb kommt, aber die Struktur noch erkennbar bleibt.
Servus
Anzeige
AW: VBA
11.06.2021 17:21:46
Markus
Kriege es nicht weiter als 820kB
AW: VBA
11.06.2021 17:04:53
ChrisL
Hi
Ein Versuch das Chaos aufzuräumen.
- Die Hauptprozedur könnte man wahrscheinlich noch weiter optimieren, wenn man wüsste, woher die Variablen kommen.
- Mangels Infos habe ich alle Variablen als Variant deklariert. Bitte noch korrigieren.

Sub tt()
Call MachEtwas(Range("F17"), MW_prod_FillerV1, SW_prod_FillerV1, Tank_SpringwaterV0, Tank_MineralwaterV0)
Call MachEtwas(Range("G17"), MW_prod_FillerV2, SW_prod_FillerV2, Tank_SpringwaterV1, Tank_MineralwaterV1)
Call MachEtwas(Range("H17"), MW_prod_FillerV3, SW_prod_FillerV3, Tank_SpringwaterV2, Tank_MineralwaterV2)
'usw.
End Sub

Private Sub MachEtwas(rng As Range, MW_prod_Filler As Variant, SW_prod_Filler As Variant, Tank_Springwater As Variant, Tank_Mineralwater As Variant)
If MW_prod_Filler / SW_prod_Filler > 1 And Tank_Springwater = Tank_Mineralwater Then
rng.Offset(0, 0).Value = Range("F14").Value * (0)
rng.Offset(1, 0).Value = Range("F14").Value * (1)
ElseIf MW_prod_Filler / SW_prod_Filler > 0.1 And MW_prod_Filler / SW_prod_Filler = Tank_Mineralwater Then
rng.Offset(0, 0).Value = Range("F14").Value * (0)
rng.Offset(1, 0).Value = Range("F14").Value * (1)
ElseIf MW_prod_Filler / SW_prod_Filler > 0.1 And MW_prod_Filler / SW_prod_Filler  0.1 Then
rng.Offset(0, 0).Value = Range("F14").Value / 2
rng.Offset(1, 0).Value = Range("F14").Value / 2
ElseIf MW_prod_Filler / SW_prod_Filler > 1 And Tank_Springwater >= Tank_Mineralwater Then
rng.Offset(0, 0).Value = Range("F14").Value * (1 / 3)
rng.Offset(1, 0).Value = Range("F14").Value * (2 / 3)
End If
End Sub
cu
Chris
Anzeige
AW: VBA
11.06.2021 17:16:31
ChrisL
nochmal kurz die Logik hinterfragt
Wenn MW/SW kleiner 0.1, dann ist es auch automatisch kleiner 1 (doppelt gemoppelt)
Wenn zwischen 0.1 und 1, dann ist die Bedingung bereits erfüllt (Spring/Mineral entweder kleiner oder grösser). Die eine Bedingung kann m.E. gar nicht eintreten.
Hinweis: Der Fall, wenn grösser 1 und Mineral kleiner Spring, ist nicht abgehandelt

If MW_prod_Filler / SW_prod_Filler > 1 And Tank_Springwater = Tank_Mineralwater Then
Rng.Offset(0, 0).Value = Range("F14").Value * (0)
Rng.Offset(1, 0).Value = Range("F14").Value * (1)
ElseIf MW_prod_Filler / SW_prod_Filler > 0.1 And MW_prod_Filler / SW_prod_Filler = Tank_Mineralwater Then
Rng.Offset(0, 0).Value = Range("F14").Value * (0)
Rng.Offset(1, 0).Value = Range("F14").Value * (1)
ElseIf MW_prod_Filler / SW_prod_Filler > 0.1 And MW_prod_Filler / SW_prod_Filler = 1 And Tank_Springwater >= Tank_Mineralwater Then
Rng.Offset(0, 0).Value = Range("F14").Value * (1 / 3)
Rng.Offset(1, 0).Value = Range("F14").Value * (2 / 3)
End If

Anzeige
AW: VBA
11.06.2021 22:06:39
Markus
Hallo Ich habe dies so mal übernommen aber jetzt ist das verhalten komplett anders.
Es wir Zeile für Zeile durchgegangen und nicht mehr spalte für Spalte.
Wie kann ich das Excel schicken wenn es 850kB ist damit Du das Verhalten im original sehen kannst.
Denn was in den Zellen F14-X14 steht wird in meinem Fall auf die Zellen F17+18 - X17+18 aufgesplittet.
AW: VBA
11.06.2021 22:08:24
Markus
Hallo Ich habe dies so mal übernommen aber jetzt ist das verhalten komplett anders.
Es wir Zeile für Zeile durchgegangen und nicht mehr spalte für Spalte.
Wie kann ich das Excel schicken wenn es 850kB ist damit Du das Verhalten im original sehen kannst.
Denn was in den Zellen F14-X14 steht wird in meinem Fall auf die Zellen F17+18 - X17+18 aufgesplittet.
Anzeige
ich hab's gewusst! :-)
11.06.2021 17:46:51
Yal
Kaum setzt man den roten Ausrufezeichen, schon stürzen sich alle drauf! ;-)
Eigentlich gibt es nur 6 Zustände, 3 mal 2:
Ratio MW / SW: unter 0.1, über 1, dazwischen
Verhältnis Spring zu Mineral: grösser oder kleiner ("grösser gleich" und "kleiner gleich" führt zu 2 möglichen Ergebnisse bei Gleichheit, je nach reihenfolge)
Man könnte diese Fälle quantifizieren und dementsprechend zuordnen:

Select Case  (MW_prod_Filler / SW_prod_Filler  1) * 2 _
+ (Tank_Springwater 
VG
Yal
Anzeige
Das Ergebnis ist übrigens...
11.06.2021 18:27:04
Yal
... immer in der Summe 1!
Entweder 100% auf einem dann 0 auf andere, 1/3 dann 2/3 oder 50%/50%. Daher könnte es eine Funktion sein, die immer die erste Werte übergibt (die für Zeile 17), die für Zeile 18 wäre 1 minus Ergebnis.
da die Bedingungen sich gegenseitig auschliessen (nur eine ist gültig), kann man die Ergebnisse summieren:

Function Berechne(MW, SW, Spring, Mineral) As Double
Berechne = _
(MW / SW > 1 And Spring >= Mineral) * (1 / 3) + _
(MW / SW  1 And Spring  0.1 And MW / SW 
@Markus: ja, so lang könnte dein Coding sein.
Man sieht dabei auf alle Fälle wesentlich deutlicher, dass es entweder einige Blödsinn in den Bedingungen gibt, oder dass es für mich spät am Freitag ist ;-)
VG
Yal
Anzeige
AW: ich hab's gewusst! :-)
11.06.2021 21:09:01
Markus
Hi
Ich bi ein absoluter Laie in VBA was meinst du mit Fälle quantifizieren und dementsprechend zuordnen
Danke
AW: ich hab's gewusst! :-)
11.06.2021 22:25:51
Yal
Es ist nicht ein VBA Problem: was nach select case ist eine einfache Formel: etwas wird geprüft, was eine True/False Ergebnis hat, multipliziert mit einer Wert z.B. 3 ergibt entweder 0 (False) oder 3 (True).
Wobei gerade denke, dass True in -1 und nicht 1 umgesetzt wird. Ändert an den Prinzip nicht.
VG
Yal
AW: ich hab's gewusst! :-)
12.06.2021 08:52:56
Daniel
Hi
Naja du solltest dir erstmal genau überlegen, in welchen Fällen was passieren soll, und versuchen, das so präzise wie möglich zu beschreiben.
Das kannst und solltest du unabhängig von der Programmierung machen.
Gruß Daniel
Anzeige
AW: VBA
11.06.2021 17:52:18
Daniel
Hi
Grundsätzlich mal versuchen, ohne Goto auszukommen.
wird normalerweise übersichtlicher.
ist das von V1 bis V20 immer das gleiche?
dann würde ich aus den 20 Einzelvariablen pro Name wie MW_prod_FillerV1 bis MW_prod_FillerV20 ein Array mit 20 Elementen machen machen: MW_prod_Filler(1) bisMW_prod_Filler(20)
dann bräuchtest du nur einen dieser 20 Blöcke tatsächlich schreiben und und den in eine Schleife packen.
das wäre mal das wichtigste. Dann bist du sicher, dass alle 20 Blöcke nach dem selben Schema ablaufen und musst nicht 20x ändern, wenn irgendwo ein Fehler drinsteckt.
Gruß Daniel
Anzeige
AW: VBA
11.06.2021 21:13:52
Markus
Ja es ist immer die Selbe abfrage nur wird eine Spalte weitergerückt Spalte F - X
Aber für so eine Schleife ist VBA für mich als Anfänger ziemlich schwierig. Gruess
Aber im ernst...
11.06.2021 19:07:06
Yal
Hallo Markus,
Dass das Gesamt ein "richtige Auswahl" trifft ist eher ein Zufallszustand. Zugegeben habe ich nur den ersten Block angeschaut.
Dessen Verallgemeinung sieht wie folgt (wie im vorige Beitrag erwähnt: man kann summieren, weil immer nur ein Fall zutrifft):

'1: If MW_prod_FillerV1 / SW_prod_FillerV1 > 1 And Tank_SpringwaterV0  1 And Spring = Tank_MineralwaterV0 Then GoTo V1_Line5 Else GoTo V1_Line6
R = R + (MW / SW = Mineral) * (0)
'7: If MW_prod_FillerV1 / SW_prod_FillerV1 > 0.1 And MW_prod_FillerV1 / SW_prod_FillerV1 = Tank_MineralwaterV0 Then GoTo V1_Line7 Else GoTo V1_Line8
R = R + (MW / SW > 0.1 And MW / SW = Mineral) * (0)
'9: If MW_prod_FillerV1 / SW_prod_FillerV1 > 0.1 And MW_prod_FillerV1 / SW_prod_FillerV1  0.1 And MW / SW  0.1 Then GoTo V1_Line11 Else GoTo V1_Line12
R = R + (MW / SW > 0.1 And MW / SW  1 And Tank_SpringwaterV0 >= Tank_MineralwaterV0 Then GoTo V1_Line13
R = R + (MW / SW > 1 And Spring >= Mineral) * (1 / 3)
Am Ende ergibt R den Multiplikator für die Zeile 17. Für 18 ist es 1-R.
Daraus ergibt sich folgende sogenannte Wahrheitstabelle (Zwischen den Klammer, die Gotos bei treffende If):
Userbild
Sichtbar wird:
_ die MW / SM = 0,1 oder =1 sind nicht behandelt, weil der "Dazwischen" auch "> 0.1 ... < 1" und nicht ">= 0.1 ... <= 1" bewertet wird
_ die Fälle in Spalte C gehören in Spalte B, sonst hat man "<=" und ">=". Wohin die Gleichheit führt, ist Reihenfolgenglück! Fall 3 vor 5 und Fall 7 vor 9.
_ der Fall 13 (in D3) kommt nie vor, weil der Fall 11 immer vorher trifft (E3)
Ich glaube, wir haben nicht nur dein Code gekürzt, aber viele Fehler, wenn nicht korrigiert, zumindest prüfbar gemacht.
VG
Yal
Anzeige
Und weh Du gibst keine rückmeldung! :-) oT
11.06.2021 19:08:40
Yal
AW: Und weh Du gibst keine rückmeldung! :-) oT
11.06.2021 21:30:02
Markus
Blicke nicht durch völlig Verloren
Lasst die Zeit :-) oT
11.06.2021 22:19:04
Yal
AW: Lasst Dir Zeit :-)
11.06.2021 22:27:26
Yal
(schreibe gerade an Smartphone :-(
Viel zu tun
12.06.2021 16:01:05
Yal
Hallo Markus,
Du hast bestimmt solchen T-Shirt gesehen: eat-biking-sleep-repeat (ich bevorzüge eat-climbing-sleep-repeat :-)
Und Du hast verstanden, das nach dem Sleep ein anderen Tag vorkommt, also Repeat bezieht sich auf dem Tag danach.
Beim programmieren ist es das gleich: mache etwas auf eine Spalte, bewege dich auf die nächste Spalte und wiederhole.
Es ist dabei zu unterscheiden: was bleibt gleich und was ändert sich. Und wenn es sich ändert, wie.
In deinem Fall:
_ die feste Werte: können sich ändern, aber die Zelle wo diese zu finden sind, ändern sich nicht (also: innerhalb einer Berechnungsvorgang)
_ die Tagesdaten: die Zeilen sind pro Wert gleich. Die Spalten sind immer +1
_ die Vortag-Daten: beim Tag 1 geht es auf den festen Werte, danach auf die Spalte davor.
Alles was sich nicht ändert, kann man als Konstant ablegen. Es vermeidet die Definition einer Variable und anschliessend sein Initialisierung. Daher die Adresse der Zellen der festen Wert und die Zeilennummer der verschiedenen Kennzahlen als Konstant.
Alles was sich ändert, soll man ein "geordnete Reihe" bringen. In Excel ist es einfach: spalten- oder zeilenweise. Dann kann man diese Spalte/Zeilen als Inkrement verwenden. Bei Dir: von Spalte 6 bis Spalte 25.
Dein Code sieht am Ende so aus:

Sub MWSP_IME()
Dim Ratio As Double
Dim Faktor As Double
Dim Sp As Double
Dim Mi As Double
Const cRO_run_time = 8 'RUNNING TIME RO PLANT PER SHIFT
Const cRoWaterFlowrate = "E8" 'Flow rate Ro Water plant 'Zeile 8, Spalte 5 -> E
Const cTank_ROwaterV0 = "E19" 'RoWater Tank Volumen0 'Zeile 19, Spalte 5 -> E
Const cTank_MineralwaterV0 = "E26" 'Mineralwater Tank Volumen0
Const cTank_SpringwaterV0 = "E34" 'Springwater Tank Volumen0
Const cFiller_Con = "F20" 'Filler Consumtion 'Zeile 20, Spalte 6 -> F
Const cCIP_Con = "F21" 'CIP Consumtion 'Zeile 21, Spalte 6 -> F
Const cCOP_Con = "F22" 'COP Consumtion
Const cZeile_MW_prod_Filler = 3 'Total Mineral Production
Const cZeile_SW_prod_Filler = 4 'Total Springwater Production
Const cZeile_Calculated_RO_HoursRO_Plant_production = 14
Const cZeile_MW_prod_Time = 17 'Hours MW producing RO time
Const cZeile_SW_prod_Time = 18 'Hours SW producing RO time
Const cZeile_Tank_ROwater = 19 'Mineralwater Tank Volumen 'Alles in Zeile 19
Const cZeile_Tank_Mineralwater = 26 'Mineralwater Tank Volumen
Const cZeile_Tank_Springwater = 34 'Springwater Tank Volumen
'*** Remaining time till tank RO Full
'Remaining Hours RO producing
'(laut original Verarbeitung, die 3 ersten Tag beziehen sich auf V0, alle andere auf Vortag. Das könnte falsch sein:
'    RO_RemTim1 = (Tank_ROwaterV0 - Tank_ROwaterV1) / RoWaterFlowrate
'    RO_RemTim2 = (Tank_ROwaterV0 - Tank_ROwaterV2) / RoWaterFlowrate
'    RO_RemTim3 = (Tank_ROwaterV0 - Tank_ROwaterV3) / RoWaterFlowrate
'    RO_RemTim4 = (Tank_ROwaterV3 - Tank_ROwaterV4) / RoWaterFlowrate
' )
'zuerst was sich innerhalb der Bearbeitung nicht ändert
Tank_ROwaterV0 = Range(cTank_ROwaterV0).Value
RoWaterFlowrate = Range(cRoWaterFlowrate).Value
RO_run_time = Range(RO_run_time).Value
'Dann pro Spalte 6 bis 25 handeln
Tank_ROwaterV0 = Range(cTank_ROwaterV0) ' Vortag
For i = 6 To 8
Tank_ROwaterV1 = Cells(cZeile_Tank_ROwater, i)     'aktueller Tag
Cells(cZeile_Calculated_RO_HoursRO_Plant_production, i).Value = _
WorksheetFunction.Min((Tank_ROwaterV0 - Tank_ROwaterV1) / RoWaterFlowrate, RO_run_time)
Next
For i = 9 To 25
Tank_ROwaterV0 = Cells(cZeile_Tank_ROwater, i - 1) 'Vortag
Tank_ROwaterV1 = Cells(cZeile_Tank_ROwater, i)     'aktueller Tag
Cells(cZeile_Calculated_RO_HoursRO_Plant_production, i).Value = _
WorksheetFunction.Min((Tank_ROwaterV0 - Tank_ROwaterV1) / RoWaterFlowrate, RO_run_time)
End If
'*** Set Remaining time to use SW MW to Produce RO water
' Bei Tank_Spring und Tank_mineral wird immer auf dem Tag davor bezogen. Bei Tag 1 sind diese Wert nicht spalten orientiert
'deswegen einen ersten Initialisierung
Sp = Range(cTank_SpringwaterV0).Value
Mi = Range(cTank_MineralwaterV0).Value
For i = 6 To 25
'Ratio ermitteln
Ratio = Range(cZeile_MW_prod_Filler, i).Value / Range(cZeile_SW_prod_Filler, i).Value
'Entscheiden
'        | Ratio        | Sp = Mi | "Sp= 1         |    1    |    0     |
'        | >= 0.1 & = 1 Then
Faktor = 1
Else
Faktor = 2 / 3
End If
Else
If Ratio = 1 Then
Faktor = 0
Else
Faktor = 1 / 3
End If
End If
'Faktor anwenden
Cells(cZeile_MW_prod_Time, i) = Cells(cZeile_Calculated_RO_HoursRO_Plant_production, i) * Faktor
Cells(cZeile_SW_prod_Time, i) = Cells(cZeile_Calculated_RO_HoursRO_Plant_production, i) * (1 - Faktor)
'nächste Schleife vorbereiten
Sp = Range(cZeile_Tank_Springwater, i)
Mi = Range(cZeile_Tank_Mineralwater, i)
Next
End Sub
'1: If MW_prod_FillerV1 / SW_prod_FillerV1 > 1 And Tank_SpringwaterV0  1 And Spring = Tank_MineralwaterV0 Then GoTo V1_Line5 Else GoTo V1_Line6
'R = R + (MW / SW = Mineral) * (0)
'==> keine Wirkung
'7: If MW_prod_FillerV1 / SW_prod_FillerV1 > 0.1 And MW_prod_FillerV1 / SW_prod_FillerV1 = Tank_MineralwaterV0 Then GoTo V1_Line7 Else GoTo V1_Line8
'R = R + (MW / SW > 0.1 And MW / SW = Mineral) * (0)
'==> keine Wirkung
'9: If MW_prod_FillerV1 / SW_prod_FillerV1 > 0.1 And MW_prod_FillerV1 / SW_prod_FillerV1  0.1 And MW / SW  0.1 Then GoTo V1_Line11 Else GoTo V1_Line12
'R = R + (MW / SW > 0.1 And MW / SW  1 And Tank_SpringwaterV0 >= Tank_MineralwaterV0 Then GoTo V1_Line13
'R = R + (MW / SW > 1 And Spring >= Mineral) * (1 / 3)
Die Produktionszeit sind zu prüfen: warum sind die Tage 2 und 3 auf "V0" berechnet? Ist es richtig?
Manche Konstante werde gar nicht gebraucht. Warum sind diese dann implementiert?
Ich habe die Wahrheitstabelle hier eingefügt und direkt darunter ein Entscheidungsbaum gebaut anstatt eine Summe. Es ist weniger Kompakt, aber leichter zu nachvollziehen. Insbesonders im Schritt-Modus beim geöffneten Lokal-Fenster kann man gut sehen, was da passiert.
Die originale Version ist unten aufgelistet. Der Ratio 0.5/0.5 kommt nicht mehr vor. Sollte es nicht richtig sein, dann die Wahrheitstabelle nochmal angehen und der Entscheidungsbaum anpassen. Es ist zur zeit 6 Fällen. Wenn Spring = Mineral dazu kommt, dann 9.
Im originale Version gab es auch verschiedene nicht nachvollziehbare Ungleichheit: MW- /SW-Prod überall auf dem aktuellen Tag aber den Vergleich Spring/Mineral mal auf Vortag mal auf aktuellen Tag.
Es ist auch klar, dass bei der vorigen Spaghetti-Code kombiniert mit einer VBA-Zurückhaltung (Spaghetti-Code führt immer zu VBA-Zurückhaltung) solche Fehler nicht zu entdecken sind.
Viel Erfolg damit. Ich hoffe, es hilft, Dir die Angst von VBA wegzunehmen. Dein Problem ist nicht kompliziert. Es war nur kompliziert implementiert worden. Es könnte sein, dass es noch Fehler drin gibt, aber jetzt hast Du eine gute Basis um ins VBA einzusteigen ;-)
VG
Yal
Schon erste Fehler entdeckt
12.06.2021 19:40:36
Yal
Beim Berechnung von Ratio:
Nicht

Ratio = Range(cZeile_MW_prod_Filler, i).Value / Range(cZeile_SW_prod_Filler, i).Value
Sondern

Ratio = Cells(cZeile_MW_prod_Filler, i).Value / Cells(cZeile_SW_prod_Filler, i).Value
Ränge erwartet eine Adresse in A1-Form. Cells erwartet 2 Zahlen: Zeile und Spalte.
VG
Yal
AW: Schon erste Fehler entdeckt
12.06.2021 20:31:59
Markus
Welchen if block sollte das End If nach der zweiten schleife schliessen?
Noch ein Fehler entdeckt
13.06.2021 01:20:45
Yal
Es sollte kein End If sondern next sein.
AW: Noch ein Fehler entdeckt
13.06.2021 08:12:21
Markus
Hi Yal
Jezt kommt nur noch ein Run time error 1004 und program stopt bei
RO_run_time = Range(RO_run_time).Value
:-(
AW: Noch ein Fehler entdeckt
13.06.2021 09:27:40
Yal
In den Range oder Cells verwendet man die deklarierten Konstanten. Im ersten Wurf hatte ich einfach die Variablennamen übernommen und festgestellt, dass es teilweise Kollision, weil die Variablen selbst dich gebraucht werden. Ich habe daher die Konstanten mit einem Präfix "c" versehen. Aber im Coding nicht durchgängig geändert.
Ich hätte vielleicht das Coding doch testen sollen.
VG
Yal
AW: Noch ein Fehler entdeckt
13.06.2021 10:13:43
Markus
Hi Yal
Muss bei cRoWaterFlowrate = Range(cRoWaterFlowrate).Value range und .value nicht weg gelassen werden? denn der Range wurde ja oben zugewiesen bei der Deklaration?
AW: Noch ein Fehler entdeckt
13.06.2021 10:19:30
Markus
Wenn ich die Konstanten mit Präfix c ergänze wo diese fehlen
cTank_ROwaterV0 = Range(cTank_ROwaterV0).Value kommt : Zuweisung der Konstanten nicht zulässig
AW: Noch ein Fehler entdeckt
13.06.2021 11:03:57
Markus
Hi Yal
Wo wurde die unten stehende abfrage bei Dir gemacht? denn diese ist die Zeit welche RO production lauft bis RO tank (F19) voll ist
Diese verbleibende Zeit wird auf Zellen F17+F18 aufgeteilt je nach dem SW tank (F34) oder MW tank(F26) und der abfrage des Filler Ratio
'*************************************************************
'*** Remaining time till tank RO Full
'*************************************************************
'Remaining Hours RO producing
Dim RO_RemTim1 As Double
RO_RemTim1 = (Tank_ROwaterV0 - Tank_ROwaterV1) / RoWaterFlowrate
If RO_RemTim1 > RO_run_time Then
Range("F14").Value = RO_run_time
Else
Range("F14").Value = RO_RemTim1
End If
Dim RO_RemTim2 As Double
RO_RemTim2 = (Tank_ROwaterV0 - Tank_ROwaterV2) / RoWaterFlowrate
If RO_RemTim2 > RO_run_time Then
Range("G14").Value = RO_run_time
Else
Range("G14").Value = RO_RemTim2
End If
AW: Noch ein Fehler entdeckt
13.06.2021 17:39:45
Yal
Hallo Markus,
Schön zu sehen, dass Du dich damit ausseinander setzt. Mein Aufwand war nicht umsonst :-)
Frage 1:
Falsch:

cRoWaterFlowrate = Range(cRoWaterFlowrate).Value
Richtig:

RoWaterFlowrate = Range(cRoWaterFlowrate).Value
Weil: RoWaterFlowrate ist die Variable. cRoWaterFlowrate ist eine Kontante, die die Adresse der Zelle liefert, wo der Wert liegt, der die Variable übergeben wird.
Frage 2:
Falsch:

cTank_ROwaterV0 = Range(cTank_ROwaterV0).Value 
Richtig:

Tank_ROwaterV0 = Range(cTank_ROwaterV0).Value 
Weil: selbe wie vorher
Frage 3:
Berechnung der "Remaining time"
RO_RemTim1 = (Tank_ROwaterV0 - Tank_ROwaterV1) / RoWaterFlowrate
die anschliessende If-Abfrage sagt:
wenn RO_RemTim1 grösser als cRO_run_time
dann cRO_run_time nehmen
sonst RO_RemTim1 nehmen
Diese Prüfung ist dasselbe als das Mininum aus RO_RemTim1 und cRO_run_time zu nehmen, weil cRO_run_time fest ist: ist die berchnete Zeit grösser als cRO_run_time, dann ist cRO_run_time das Minimum und umgekehrt auch. Also Min (als WorksheetFunction, da VBA kein Min hat).
Frage 4:
Es geht hier um die Korrektur der Tag 2 und 3.
Die Wahrheitstabelle war unvollständig. Beim Nachbauen habe ich gesehen, dass die Gleichheit Sp = Mi doch separat zu handeln sei:

'        | Ratio        | Sp  Mi | "Sp=Mi" ist sowohl in  "Sp<=Mi" als auch in "Sp>=Mi" drin.
'        | < 0.1        |    1    |    1    |    0    | (3), (2) und (5)
'        | >= 0.1 & < 1 |    1    |   0.5   |    0    | (9), (11) und (7)
'        | >= 1         |   2/3   |   0.5   |   1/3   | (1), (11) und (13)
Dementprechend ändert sich das Entscheidungsbaum. Man kann pro Spalte je 2 Ergebnis zusammenfassen. Hier auch prüfen und bei Bedarf anpassen (idealerweise die Wahrheitstabelle als Referenz dokumentieren ;-)
Anbei eine vollständig korrigierte Code. Alle nicht verwendete Konstanten habe ich aussortiert.

Sub MWSP_IME()
Dim Ratio As Double
Dim Faktor As Double
Dim Sp As Double
Dim Mi As Double
Const cRO_run_time = 8 'RUNNING TIME RO PLANT PER SHIFT
Const cRoWaterFlowrate = "E8" 'Flow rate Ro Water plant 'Zeile 8, Spalte 5 -> E
Const cTank_ROwaterV0 = "E19" 'RoWater Tank Volumen0 'Zeile 19, Spalte 5 -> E
Const cTank_MineralwaterV0 = "E26" 'Mineralwater Tank Volumen0
Const cTank_SpringwaterV0 = "E34" 'Springwater Tank Volumen0
Const cZeile_MW_prod_Filler = 3 'Total Mineral Production
Const cZeile_SW_prod_Filler = 4 'Total Springwater Production
Const cZeile_Calculated_RO_HoursRO_Plant_production = 14
Const cZeile_MW_prod_Time = 17 'Hours MW producing RO time
Const cZeile_SW_prod_Time = 18 'Hours SW producing RO time
Const cZeile_Tank_ROwater = 19 'Mineralwater Tank Volumen 'Alles in Zeile 19
Const cZeile_Tank_Mineralwater = 26 'Mineralwater Tank Volumen
Const cZeile_Tank_Springwater = 34 'Springwater Tank Volumen
'*** Remaining time till tank RO Full
'Remaining Hours RO producing
'zuerst was sich innerhalb der Bearbeitung nicht ändert
Tank_ROwaterV0 = Range(cTank_ROwaterV0).Value
RoWaterFlowrate = Range(cRoWaterFlowrate).Value
Tank_ROwaterV0 = Range(cTank_ROwaterV0) ' Vortag bei Tag 1
'Dann pro Spalte 6 bis 25 handeln
For i = 6 To 25
Tank_ROwaterV1 = Cells(cZeile_Tank_ROwater, i)     'aktueller Tag
Cells(cZeile_Calculated_RO_HoursRO_Plant_production, i).Value = _
WorksheetFunction.Min((Tank_ROwaterV0 - Tank_ROwaterV1) / RoWaterFlowrate, cRO_run_time)
Tank_ROwaterV0 = Cells(cZeile_Tank_ROwater, i) 'Vortag für nächste Schleife
Next
'*** Set Remaining time to use SW MW to Produce RO water
' Bei Tank_Spring und Tank_mineral wird immer auf dem Tag davor bezogen. Bei Tag 1 sind diese Wert nicht spalten orientiert
'deswegen einen ersten Initialisierung
Sp = Range(cTank_SpringwaterV0).Value
Mi = Range(cTank_MineralwaterV0).Value
For i = 6 To 25
'Ratio ermitteln
Ratio = Cells(cZeile_MW_prod_Filler, i).Value / Cells(cZeile_SW_prod_Filler, i).Value
'Entscheiden
'        | Ratio        | Sp  Mi | "Sp=Mi" ist sowohl in  "Sp<=Mi" als auch in "Sp>=Mi" drin.
'        | < 0.1        |    1    |    1    |    0    | (3), (2) und (5)
'        | >= 0.1 & < 1 |    1    |   0.5   |    0    | (9), (11) und (7)
'        | >= 1         |   2/3   |   0.5   |   1/3   | (1), (11) und (13)
If Sp  Mi
If Ratio = Tank_MineralwaterV0 Then GoTo V1_Line5 Else GoTo V1_Line6
'R = R + (MW / SW = Mineral) * (0)
'(9): If MW_prod_FillerV1 / SW_prod_FillerV1 > 0.1 And MW_prod_FillerV1 / SW_prod_FillerV1  0.1 And MW / SW  0.1 And MW_prod_FillerV1 / SW_prod_FillerV1 = Tank_MineralwaterV0 Then GoTo V1_Line7 Else GoTo V1_Line8
'R = R + (MW / SW > 0.1 And MW / SW = Mineral) * (0)
'(1): If MW_prod_FillerV1 / SW_prod_FillerV1 > 1 And Tank_SpringwaterV0  1 And Spring  1 And Tank_SpringwaterV0 >= Tank_MineralwaterV0 Then GoTo V1_Line13
'R = R + (MW / SW > 1 And Spring >= Mineral) * (1 / 3)
'(11): If MW_prod_FillerV1 / SW_prod_FillerV1  0.1 Then GoTo V1_Line11 Else GoTo V1_Line12
'R = R + (MW / SW > 0.1 And MW / SW 
VG Yal
AW: Noch ein Fehler entdeckt
13.06.2021 20:39:09
Markus
Hi YAL
Wie kann ich die DIVISION /0 abfangen? denn ich have Wochen bei welchem Ich nur MW habe und SP=0
'Ratio ermitteln
Ratio = Cells(cZeile_MW_prod_Filler, i).Value / Cells(cZeile_SW_prod_Filler, i).Value
AW: Noch ein Fehler entdeckt
13.06.2021 21:10:36
Markus
Hallo Yal
Aber dies wird nicht abgefangen im Cod denn ich habe ja pro Schicht 8h zur Verfügung. Mit der Formel habe ich bestimmt
wenn RO_RemTim1 > RO_run_time~f~ Damit der Tank wieder bis 550'000 gefüllt wird. Wenn natürlich die Füllzeit grösser ist als die Arbeitzei(8h) dann setz er 8h
ansonsten die Zeit die es noch braucht um die 550000 zu erreichen dies siehst du im angehängten Bild gelb markiert wie der alte Fall war.
Dies breuche ich damit der Ro Tank nicht leer läuft.
<img src="https://www.herber.de/bbs/user/146596.jpg" border="0" Width="700" Height="289" alt="Userbild">
<img src="https://www.herber.de/bbs/user/146595.jpg" border="0" Width="700" Height="277" alt="Userbild">
~f~
'Remaining Hours RO producing
Dim RO_RemTim1 As Double
RO_RemTim1 = (Tank_ROwaterV0 - Tank_ROwaterV1) / RoWaterFlowrate
If RO_RemTim1 > RO_run_time Then
Range("F14").Value = RO_run_time
Else
Range("F14").Value = RO_RemTim1
End If
Dim RO_RemTim2 As Double
RO_RemTim2 = (Tank_ROwaterV1 - Tank_ROwaterV2) / RoWaterFlowrate
If RO_RemTim2 > RO_run_time Then
Range("G14").Value = RO_run_time
Else
Range("G14").Value = RO_RemTim2
End If
Dim RO_RemTim3 As Double
RO_RemTim3 = (Tank_ROwaterV2 - Tank_ROwaterV3) / RoWaterFlowrate
If RO_RemTim3 > RO_run_time Then
Range("H14").Value = RO_run_time
Else
Range("H14").Value = RO_RemTim3
End IF
Dim RO_RemTim4 As Double
RO_RemTim4 = (Tank_ROwaterV3 - Tank_ROwaterV4) / RoWaterFlowrate
If RO_RemTim4 > RO_run_time Then
Range("I14").Value = RO_run_time
Else
Range("I14").Value = RO_RemTim4
End If
AW: Noch ein Fehler entdeckt
13.06.2021 21:27:52
Yal
Hallo Markus,
bei einer Division müsste vorher geprüft, ob der Dividierende nicht null ist:

If X  0 Then
A = B / X
End If
Oder Du setzt eine Fehlertoleranz:

On Error Resume Next
Bei Fehler wird einfach auf die nächste Anweisung gesprungen. Es führt aber dazu, dass manche Fehler nicht endeckt werden.
Ich habe dein Wald in eingereihten Bäumen geordnet, aber für die Fachlichkeit kann ich nicht beitragen. Idealerweise hast Du eine Sparing Partner, der Dir über die Schulter schauen kann und von dem Thema auch etwas weisst.
VG
Yal
AW: Noch ein Fehler entdeckt
14.06.2021 10:19:33
Markus
Hallo Yal
Ich bräuchte eigentlich nur noch diese zwei abfragen aber ich bin zu doof dazu :-(
Die erste sollte abfragen wenn die Produktionszeit über 8h liegt dann soll max 8 stunden produziert werden und diese natürlich wie gehabt die Zeiten Verteilen jeweils MW SW brauchen zum produzieren.
Diese zweite abfrage soll sicherstellen wenn der RO Tank kleiner als 550000 ist und noch ausreichen Produktionszeit vorhanden für die Schicht das der Tank auch weiter gefüllt wird bis maximal 8h erreicht sind.
Const cZeile_Calculated_RO_Plant_production_Tank_Full = 14 'Total Hours till Tank get 550'000Liter
If ((Tank_ROwaterV0 - Tank_ROwaterV1) / cRoWaterFlowrate) > cRO_run_time Then
If ((Tank_ROwaterV0 - Tank_ROwaterV1) / cRoWaterFlowrate) < cRO_run_time AND (Tank_ROwaterV0 - Tank_ROwaterV1)< Tank_ROwaterV0
AW: Noch ein Fehler entdeckt
14.06.2021 13:46:52
Yal
Hallo Markus,
da Du noch nicht Programmierung-geübt bist, würde ich Dir vorschlagen, immer die Fälle in natürliche Sprache zu formulieren und zu strukturieren.
Zum Beispiel ist mir nicht klar, wenn der Tank befüllt werden soll, warum Tank_ROwaterV0 - Tank_ROwaterV1 berechnet wird:
V1 wird alle Fälle grösser als V0 sein wird. So wird das Delta negativ (!) und kann nie grösser als ein positive Zahl werden.
Dementsprechend muss Du dir eine klares Bild welche Variable welche Messung zu welchem Zeitpunkt darstellen sollen und wie diese im Lauf der Zeit sich entwickeln bzw. was zu erwarten ist. Diese Analyse hat nicht mit Programmierung zu tun. Ein nicht verstandene Sachverhalt zu codieren, führt nicht dazu, dass diese verstanden wird, sondern nur zu etwas, was noch komplizierter zu verstehen wird und sowieso falsch wird.
Und das Programmieren lernen oder probieren mit etwas, was nie funktioniert, macht kein Spass. Die erste Schritte in die Programmierung sollten Spass machen :-) Und nein, das hat nicht mit doof zu sein: man kann nicht von einem Kind, der gerade laufen lernt, erwarten, dass es Eiskunstlauf-Figuren beherrscht.
Wenn ich richtig verstanden habe, ist die ganze Komplexität nur durch diese Fall-Betrachtung um die Allokation der Produktionszeit auf MW und SW. Es ist, wie bereit gezeigt, eine 3x3 Matrix. Eigentlich könnte alles mit Formeln entwickelt werden. Die erste Schritte wäre, Excel und seine Möglichkeiten richtig kennen zu lernen.
VG
Yal
AW: Noch ein Fehler entdeckt
14.06.2021 15:37:55
Markus
Hi Yal
Das habe ich ja im Excel so abgebildet welches ich hochgeladen habe.
In der Zeile 14 wird die Zeit berechnet um den Tank Zeile 19 wieder auf 550000liter zu bringen
Zeile 15 ist die Zeit welche die RO Anlage laufen muss um nur den Teil wieder zu produzieren welcher am Selben Tag gebraucht wird =SUMME(F20:F22)/$E$8
Aber da ja 8h pro schicht gearbeitet wird kann es sein, dass der Ro Tank so leer ist das theoretisch in dieser Schicht über 8h produziert werden müsste kann aber nicht wegen Schicht zeit das heisst die Anlage würde max 8h Laufen das habe ich so in Zeile 14 gemacht mit der Zeit wie unten im code Schnipsel dargestellt.
Dan gibt es ja noch der Fall welcher die Produktionszeit der RO Anlage einschränkt wenn der Tank zum beispiel 489800 liter inhalt schon hat. Da kann die Anlage ja nur noch 1h produzieren
'Remaining Hours RO producing
Dim RO_RemTim1 As Double
RO_RemTim1 = (Tank_ROwaterV0 - Tank_ROwaterV1) / RoWaterFlowrate
If RO_RemTim1 > RO_run_time Then
Range("F14").Value = RO_run_time
Else
Range("F14").Value = RO_RemTim1
End If
AW: Noch ein Fehler entdeckt
14.06.2021 17:42:50
Markus
Hi Yal
Probiere gerade dies zu implementieren '*** Remaining time till tank RO Full Zeile 14.
Was mag er an diesem nicht?
<pre>Sub MWSP_IME_W4()
Range("E14:Y14,E17:Y18").Select
Selection.ClearContents
Dim Ratio As Double
Dim Faktor As Double
Dim Sp As Double
Dim Mi As Double
Const cRO_run_time = 8 'RUNNING TIME RO PLANT PER SHIFT
Const cRoWaterFlowrate = "E8" 'Flow rate Ro Water plant 'Zeile 8, Spalte 5 -> E
Const cTank_ROwaterV0 = "E19" 'RoWater Tank Volumen0 'Zeile 19, Spalte 5 -> E
Const cTank_MineralwaterV0 = "E26" 'Mineralwater Tank Volumen0
Const cTank_SpringwaterV0 = "E34" 'Springwater Tank Volumen0
Const cZeile_MW_prod_Filler = 3 'Total Mineral Production
Const cZeile_SW_prod_Filler = 4 'Total Springwater Production
Const cZeile_Calculated_RO_Remainig_production_Tank_Full = 14 'Total Hours till Tank get 550'000Liter
Const cZeile_Calculated_RO_HoursRO_Plant_production = 15 ' Total hours für die Production
Const cZeile_MW_prod_Time = 17 'Hours MW producing RO time
Const cZeile_SW_prod_Time = 18 'Hours SW producing RO time
Const cZeile_Tank_ROwater = 19 'Mineralwater Tank Volumen 'Alles in Zeile 19
Const cZeile_Tank_Mineralwater = 26 'Mineralwater Tank Volumen
Const cZeile_Tank_Springwater = 34 'Springwater Tank Volumen
'*************************************************************
'*** Remaining time till tank RO Full
'*************************************************************
'Remaining Hours RO producing
'zuerst was sich innerhalb der Bearbeitung nicht ändert
Tank_ROwaterV0 = Range(cTank_ROwaterV0).Value
RoWaterFlowrate = Range(cRoWaterFlowrate).Value
Tank_ROwaterV0 = Range(cTank_ROwaterV0) ' Vortag bei Tag 1
'Dann pro Spalte 6 bis 25 handeln
For i = 6 To 25
Tank_ROwaterV1 = Cells(cZeile_Tank_ROwater, i) 'aktueller Tag
Cells(cZeile_Calculated_RO_HoursRO_Plant_production, i).Value = _
WorksheetFunction.Min((Tank_ROwaterV0 - Tank_ROwaterV1) / RoWaterFlowrate, cRO_run_time)
Tank_ROwaterV0 = Cells(cZeile_Tank_ROwater, i) 'Vortag für nächste Schleife
Next
'*************************************************************
'*** Remaining time till tank RO Full Zeile 14
'*************************************************************
'Remaining Hours RO producing
' Dim RO_RemTim1 As Double
' cZeile_Calculated_RO_Remainig_production_Tank_Full = (Tank_ROwaterV0 - Tank_ROwaterV1) / RoWaterFlowrate
' If RO_RemTim1 > RO_run_time Then
' Range("F14").Value = RO_run_time
' Else
' Range("F14").Value = RO_RemTim1
' End If
'zuerst was sich innerhalb der Bearbeitung nicht ändert
Tank_ROwaterV0 = Range(cTank_ROwaterV0).Value
RoWaterFlowrate = Range(cRoWaterFlowrate).Value
Calculated_RO_Remainig_production_Tank_Full = Range(cZeile_Calculated_RO_Remainig_production_Tank_Full) ' Vortag bei Tag 1
'Dann pro Spalte 6 bis 25 handeln
For i = 6 To 25
Calculated_RO_Remainig_production_Tank_Full = Cells(cZeile_Calculated_RO_Remainig_production_Tank_Full, i) 'aktueller Tag
Cells(cZeile_Calculated_RO_Remainig_production_Tank_Full, i).Value = _
(Tank_ROwaterV0 - (Cells(cZeile_Tank_ROwater, i))) / RoWaterFlowrate 'Vortag für nächste Schleife
Next
'*************************************************************
'*** Set Remaining time to use SW MW to Produce RO water
'*************************************************************
' Bei Tank_Spring und Tank_mineral wird immer auf dem Tag davor bezogen. Bei Tag 1 sind diese Wert nicht spalten orientiert
'deswegen einen ersten Initialisierung
Sp = Range(cTank_SpringwaterV0).Value
Mi = Range(cTank_MineralwaterV0).Value
For i = 6 To 25
'Ratio ermitteln
Ratio = Cells(cZeile_MW_prod_Filler, i).Value / Cells(cZeile_SW_prod_Filler, i).Value
'Entscheiden
' | Ratio | Sp < Mi | Sp = Mi | Sp > Mi | "Sp=Mi" ist sowohl in "Sp<=Mi" als auch in "Sp>=Mi" drin.
' | < 0.1 | 1 | 1 | 0 | (3), (2) und (5)
' | >= 0.1 & < 1 | 1 | 0.5 | 0 | (9), (11) und (7)
' | >= 1 | 2/3 | 0.5 | 1/3 | (1), (11) und (13)
If Sp < Mi Then
If Ratio < 1 Then 'Ratio < 0.1 und Ratio zwischen 0.1 und 1 zusammengefasst in Ratio < 1, weil geleiche Ergebnis
Faktor = 1
Else
Faktor = 6 / 8
End If
ElseIf Sp = Mi Then
If Ratio < 0.1 Then
Faktor = 1
Else 'Ratio zw. 0.1-1 und >1 zusammengefasst.
Faktor = 0.5
End If
Else ' Sp > Mi
If Ratio < 1 Then 'Ratio &kt; 0.1 und zw. 0.1-1 zusammengefasst
Faktor = 0
Else
Faktor = 2 / 8
End If
End If
'Faktor anwenden
Cells(cZeile_MW_prod_Time, i) = Cells(cZeile_Calculated_RO_HoursRO_Plant_production, i) * Faktor
Cells(cZeile_SW_prod_Time, i) = Cells(cZeile_Calculated_RO_HoursRO_Plant_production, i) * (1 - Faktor)
'nächste Schleife vorbereiten
Sp = Cells(cZeile_Tank_Springwater, i)
Mi = Cells(cZeile_Tank_Mineralwater, i)
Next
End Sub</pre>
Mache es kleine Stücke
14.06.2021 18:45:08
Yal
zum Beispiel die Berechnung der Faktor kann in einer Function abgelagert werden. Wenn Du diese in einem Modul (NICHT im Codepane von Tabelle 6, sondern in Modul1), kannst Du diese Funktion als ganz normale Excel-Formel in deiner Tabellenblatt verwenden:
Setzt bitte sehr unter VB-Editor, Extras, Optionen, "Variabledeklaration erforderlich" ein. Für Anfänger ein Muss: nur Variable verwenden, die Deklariert worden sind.
Die Variabledeklaration findet immer sofort hinter der Sub/Function-Deklaration. Nicht dazwischen!
Deine Frage für den '*** Remaining time till tank RO Full Zeile 14
könnte auch in eine Function umgewandelt werden, die 3 Parameter annehmen wird

Public Function Remaining_Hours_RO_producing(BasisRO, ZielRO, FlowRate) As Double
Remaining_Hours_RO_producing = (BasisRO - ZielRO) / FlowRate
End Function
Du siehst aber vielleicht ein, dass eine so einfache Berechnung keine VBA-UDF (User Defined Function) braucht. Es könnte leichter direkt in Excel eingebaut werden.
Das gleich für das Remaining time

Public Function Remaining_RO_Time(BasisRO, ZielRO, FlowRate, RunTime) As Double
Remaining_RO_Time = WorksheetFunction.Min((BasisRO - ZielRO) / FlowRate, RunTime)
End Function
Wie vorher gesagt: Wenn BasisRO (=Vortag-Wert) höher als ZielRO (Tageswert), dann negativ, dann immer Minimum!!!
Auch so mit dem halb-komplizierte Faktor-Ermittlung:

Public Function Faktor_errechnen(MW, SW, Sp, Mi) As Double
Dim Ratio
'Entscheiden
' | Ratio        | Sp < Mi | Sp = Mi | Sp > Mi |
' |  0 Then
Ratio = MW / SW
Select Case True
Case Sp = 1:   Faktor = 6 / 8
Case Sp = Mi And Ratio = 0.1: Faktor = 0.5
Case Sp > Mi And Ratio  Mi And Ratio >= 1:   Faktor = 2 / 8
End Select
End If
End Function
"select case" ist nur eine andere Form von mehrfachen If. Eigentlich selbsprechend.
AW: Mache es kleine Stücke
16.06.2021 05:57:36
Markus
Hallo Yal
Herzlichen Dank für deine Hilfe hat doch noch geklappt. Aber definitiv ein grosser Programmierer werde ich nicht:-)
AW: Noch ein Fehler entdeckt
13.06.2021 21:10:52
Markus
Hallo Yal
Aber dies wird nicht abgefangen im Cod denn ich habe ja pro Schicht 8h zur Verfügung. Mit der Formel habe ich bestimmt
wenn RO_RemTim1 > RO_run_time~f~ Damit der Tank wieder bis 550'000 gefüllt wird. Wenn natürlich die Füllzeit grösser ist als die Arbeitzei(8h) dann setz er 8h
ansonsten die Zeit die es noch braucht um die 550000 zu erreichen dies siehst du im angehängten Bild gelb markiert wie der alte Fall war.
Dies breuche ich damit der Ro Tank nicht leer läuft.
<img src="https://www.herber.de/bbs/user/146596.jpg" border="0" Width="700" Height="289" alt="Userbild">
<img src="https://www.herber.de/bbs/user/146595.jpg" border="0" Width="700" Height="277" alt="Userbild">
~f~
'Remaining Hours RO producing
Dim RO_RemTim1 As Double
RO_RemTim1 = (Tank_ROwaterV0 - Tank_ROwaterV1) / RoWaterFlowrate
If RO_RemTim1 > RO_run_time Then
Range("F14").Value = RO_run_time
Else
Range("F14").Value = RO_RemTim1
End If
Dim RO_RemTim2 As Double
RO_RemTim2 = (Tank_ROwaterV1 - Tank_ROwaterV2) / RoWaterFlowrate
If RO_RemTim2 > RO_run_time Then
Range("G14").Value = RO_run_time
Else
Range("G14").Value = RO_RemTim2
End If
Dim RO_RemTim3 As Double
RO_RemTim3 = (Tank_ROwaterV2 - Tank_ROwaterV3) / RoWaterFlowrate
If RO_RemTim3 > RO_run_time Then
Range("H14").Value = RO_run_time
Else
Range("H14").Value = RO_RemTim3
End IF
Dim RO_RemTim4 As Double
RO_RemTim4 = (Tank_ROwaterV3 - Tank_ROwaterV4) / RoWaterFlowrate
If RO_RemTim4 > RO_run_time Then
Range("I14").Value = RO_run_time
Else
Range("I14").Value = RO_RemTim4
End If
AW: Viel zu tun
12.06.2021 20:26:37
Markus
Eigentlich Sollte Tag Zwei aus Tag eins berechnet werden V0Ist das Initial Volumen aber auch das Max Volumen welches wären der Tage erreicht werden kann.

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige