Variable de control siguiente no válido.
Me encuentro con un error “Error de compilación: variable de control Next no válida de referencia”.
Intentando saltar líneas de código si la variable no se encuentra en la hoja, por ejemplo, si X = 0 entonces salte. No puedo depurar paso a paso ya que salta directamente al error.
Agradezco cualquier ayuda o sugerencia.
Dim a Como Integer
Dim b Como Integer
Dim D Como Integer
‘ {…….}
‘ a
Freight_Str_Mínimo_Lista(1) = strFreightperMinCol:
Freight_Str_Mínimo_Lista(2) = strFreightMinCol:
Freight_Str_Mínimo_Lista(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_Lista(1) = strFreightperKgCol:
Freight_Str_PerKg_Lista(2) = strFreightperkgAll_InCol:
Freight_Str_PerKg_Lista(3) = strFreightless45All_InCol:
Freight_Str_PerKg_Lista(4) = strFreightgreater45All_InCol:
Freight_Str_PerKg_Lista(5) = strFreight100All_InCol:
‘ esto continúa hasta (9)
Para a = 1 a 3
Para b = 1 a 3
Para D = 1 a 9
Si Freight_Str_Minimum_Lista(a) = 0 Luego ir a nextsegment3
Si Freight_Col_Minimum_Lista(b) = 0 Luego ir a nextsegment3
Si Freight_Col_PerKg_List (D) = 0 Luego ir a nextsegment3
‘ líneas de código con cálculos con … end con
nextsegment3:
Siguiente a
Siguiente b
Siguiente D
davy.ai
Parece que estás intentando omitir líneas de código si la variable no se encuentra en la hoja. Para hacer esto, puedes usar una combinación de bucles
For
y declaracionesIf
. Por ejemplo: