title: Invalid Next Control Variable
body: <p>I am hitting a wall with the error &quot;Compile Error: Invalid Next Control variable reference&quot;.
  Trying to skip code lines if the variable is not found in the sheet, e.g if X = 0 then skip. Can't debug step by step since it jumps straight to the error.</p>
  <p>appreciate any 2 cents</p>
  <pre><code>Dim a As Integer
  Dim b As Integer
  Dim D As Integer
  
  '{.......}
  
  ' a
  Freight_Str_Minimum_List(1) = strFreightperMinCol:
  Freight_Str_Minimum_List(2) = strFreightMinCol:
  Freight_Str_Minimum_List(3) = strMOtherMinCol
  
  ' b
  Freight_Col_Minimum_List(1) = FreightperMinCol:
  Freight_Col_Minimum_List(2) = FreightMinCol:
  Freight_Col_Minimum_List(3) = MOtherMinCol
  
  ' d
  Freight_Str_PerKg_List(1) = strFreightperKgCol:
  Freight_Str_PerKg_List(2) = strFreightperkgAll_InCol:
  Freight_Str_PerKg_List(3) = strFreightless45All_InCol:
  Freight_Str_PerKg_List(4) = strFreightgreater45All_InCol:
  Freight_Str_PerKg_List(5) = strFreight100All_InCol:
  
  ' this goes until (9)
  
  For a = 1 To 3
  For b = 1 To 3
  For D = 1 To 9
  
  If Freight_Str_Minimum_List(a) = 0 Then GoTo nextsegment3
  If Freight_Col_Minimum_List(b) = 0 Then GoTo nextsegment3
  If Freight_Col_PerKg_List(D) = 0 Then GoTo nextsegment3
  
  
  'lines of code with calculations With...end with
  
  nextsegment3:
  Next a
  Next b
  Next D
  </code></pre>