当我收到“PROCEDURE TOO LARGE”编译错误时,我将我的代码分成多个较小的子程序,但我仍然收到此错误,我不知道如何将它分开。 这是代码的一部分,我不知道如何划分更多(因为变量“我”在主代码中没有更新,因为它应该 - 它的值重置为0与其他变量相同:
X7 = 109
Z7 = 0
For Q7 = 92 + Z6 To X6
If Cells(Q7, I + 4).Value = "" Then GoTo OPERATOR7I
If Cells(Q7, I + 4).Value >= TARGET - 0.01 Then GoTo OPERATOR7H
If Cells(Q7, I + 4).Value < TARGET - 0.01 Then
Cells(X7, I + 1).Value = Cells(Q7, I + 1).Value
Cells(X7, I + 4).Value = TARGET - Cells(Q7, I + 4).Value
Z7 = Z7 + 1
End If
If Cells(123, I + 5).Value < 60 + KK - 0.5 Then GoTo OPERATOR7F
If Cells(123, I + 5).Value > 60 + KK - 0.5 And Cells(123, I + 5).Value < 60 + KK + 0.5 Then GoTo OPERATOR7D
If Cells(123, I + 5).Value > 60 + KK + 0.5 Then GoTo OPERATOR7G
OPERATOR7G:
Cells(X7, I + 4).Value = Cells(X7, I + 4).Value - 1
If Cells(123, I + 5).Value > 60 + KK + 0.5 Then GoTo OPERATOR7G
If Cells(123, I + 5).Value > 60 + KK - 0.5 And Cells(123, I + 5).Value < 60 + KK + 0.5 Then GoTo OPERATOR7D
OPERATOR7I:
OPERATOR7F:
If Z7 = 0 Then GoTo LOOP0EDIT7
X7 = X7 + 1
LOOP0EDIT7:
OPERATOR7H:
Next Q7
If Application.Sum(Range(Cells(7, I + 15), Cells(Y1, I + 15))) < 0.01 Then GoTo LOOPRECALC7B
For XOXO7 = 7 To Y1
If Cells(XOXO7, I + 15).Value > 0.01 Then
Cells(X7, I + 1).Value = Cells(XOXO7, 3).Value
Cells(X7, I + 4).Value = Cells(XOXO7, I + 15).Value
X7 = X7 + 1
Z7 = Z7 + 1
End If
Next XOXO7
LOOPRECALC7C:
If Cells(123, I + 5).Value > 60 + KK + 0.5 Then GoTo LOOPRECALC7A
If Cells(123, I + 5).Value > 60 + KK - 0.5 And Cells(123, I + 5).Value < 60 + KK + 0.5 Then GoTo LOOPRECALC7B
If Cells(123, I + 5).Value < 60 + KK - 0.5 Then GoTo LOOPRECALC7B
LOOPRECALC7A:
Cells(X7, I + 4).Value = Cells(X7, I + 4).Value - 1
GoTo LOOPRECALC7C
LOOPRECALC7B:
OPERATOR7A:
If Cells(Y1 + 1, 3).Value = "" Then GoTo EXITLOOP7
If Cells(Y1 + 1, 4).Value = "Kontrola kvaliteta." Then GoTo QUALITYLOOP7A
Cells(X7, I + 1).Value = Cells(Y1 + 1, 3).Value
Cells(X7, I + 4).Value = TARGET
Y1 = Y1 + 1
GoTo QUALITYLOOP7B
QUALITYLOOP7A:
Y1 = Y1 + 1
GoTo OPERATOR7A
QUALITYLOOP7B:
OPERATOR7E:
If Cells(123, I + 5).Value < 60 + KK - 0.5 Then GoTo OPERATOR7B
If Cells(123, I + 5).Value > 60 + KK - 0.5 And Cells(123, I + 5).Value < 60 + KK + 0.5 Then GoTo OPERATOR7D
If Cells(123, I + 5).Value > 60 + KK + 0.5 Then GoTo OPERATOR7C
OPERATOR7B:
X7 = X7 + 1
GoTo OPERATOR7A
OPERATOR7C:
Cells(X7, I + 4).Value = Cells(X7, I + 4).Value - 1
GoTo OPERATOR7E
OPERATOR7D:
EXITLOOP7:
'OPERATOR8 LOOP
X8 = 126
Z8 = 0
For Q8 = 109 + Z7 To X7
If Cells(Q8, I + 4).Value = "" Then GoTo OPERATOR8I
If Cells(Q8, I + 4).Value >= TARGET - 0.01 Then GoTo OPERATOR8H
If Cells(Q8, I + 4).Value < TARGET - 0.01 Then
Cells(X8, I + 1).Value = Cells(Q8, I + 1).Value
Cells(X8, I + 4).Value = TARGET - Cells(Q8, I + 4).Value
Z8 = Z8 + 1
End If
If Cells(140, I + 5).Value < 60 + KK - 0.5 Then GoTo OPERATOR8F
If Cells(140, I + 5).Value > 60 + KK - 0.5 And Cells(140, I + 5).Value < 60 + KK + 0.5 Then GoTo OPERATOR8D
If Cells(140, I + 5).Value > 60 + KK + 0.5 Then GoTo OPERATOR8G
OPERATOR8G:
Cells(X8, I + 4).Value = Cells(X8, I + 4).Value - 1
If Cells(140, I + 5).Value > 60 + KK + 0.5 Then GoTo OPERATOR8G
If Cells(140, I + 5).Value > 60 + KK - 0.5 And Cells(140, I + 5).Value < 60 + KK + 0.5 Then GoTo OPERATOR8D
OPERATOR8I:
OPERATOR8F:
If Z8 = 0 Then GoTo LOOP0EDIT8
X8 = X8 + 1
LOOP0EDIT8:
OPERATOR8H:
Next Q8
If Application.Sum(Range(Cells(7, I + 15), Cells(Y1, I + 15))) < 0.01 Then GoTo LOOPRECALC8B
For XOXO8 = 7 To Y1
If Cells(XOXO8, I + 15).Value > 0.01 Then
Cells(X8, I + 1).Value = Cells(XOXO8, 3).Value
Cells(X8, I + 4).Value = Cells(XOXO8, I + 15).Value
X8 = X8 + 1
Z8 = Z8 + 1
End If
Next XOXO8
LOOPRECALC8C:
If Cells(140, I + 5).Value > 60 + KK + 0.5 Then GoTo LOOPRECALC8A
If Cells(140, I + 5).Value > 60 + KK - 0.5 And Cells(140, I + 5).Value < 60 + KK + 0.5 Then GoTo LOOPRECALC8B
If Cells(140, I + 5).Value < 60 + KK - 0.5 Then GoTo LOOPRECALC8B
LOOPRECALC8A:
Cells(X8, I + 4).Value = Cells(X8, I + 4).Value - 1
GoTo LOOPRECALC8C
LOOPRECALC8B:
OPERATOR8A:
If Cells(Y1 + 1, 3).Value = "" Then GoTo EXITLOOP8
If Cells(Y1 + 1, 4).Value = "Kontrola kvaliteta." Then GoTo QUALITYLOOP8A
Cells(X8, I + 1).Value = Cells(Y1 + 1, 3).Value
Cells(X8, I + 4).Value = TARGET
Y1 = Y1 + 1
GoTo QUALITYLOOP8B
QUALITYLOOP8A:
Y1 = Y1 + 1
GoTo OPERATOR8A
QUALITYLOOP8B:
OPERATOR8E:
If Cells(140, I + 5).Value < 60 + KK - 0.5 Then GoTo OPERATOR8B
If Cells(140, I + 5).Value > 60 + KK - 0.5 And Cells(140, I + 5).Value < 60 + KK + 0.5 Then GoTo OPERATOR8D
If Cells(140, I + 5).Value > 60 + KK + 0.5 Then GoTo OPERATOR8C
OPERATOR8B:
X8 = X8 + 1
GoTo OPERATOR8A
OPERATOR8C:
Cells(X8, I + 4).Value = Cells(X8, I + 4).Value - 1
GoTo OPERATOR8E
OPERATOR8D:
EXITLOOP8:
代码继续使用这些LOOPS(X9,X10,X11 ......)和变量“KK”&amp; “I”也用于其他函数的代码的其他部分(其中一些被分成更小的子程序)!如何缩短这个?