Hi there,
I have a problem I just can't fix. I need to find if a product exists so it shouldn't be treated twice (or more). Here's my code :
Dim table As Variant
finalLig = Cells(Application.Rows.Count, 1).End(xlUp).row
table= Range("C3:D" & finalLig).Value 'two dimensionnal array (nb of products, 2 columns. 2nd column is just here to create a multidimmensionnal array)
For i = LBound(tableau) To UBound(table) 'For all values in the array (barcodes)
If table(i, 2) <> 1 Then
Valeur = table(i, 1) 'Value to check
For J = LBound(tableau) To UBound(tableau) 'Loop in the table
valeurComp = tableau(J, 1)
If Valeur = valeurComp And i <> J Then 'If two lines share the same code, then
table(i, 2) = 1 'remember that this value shouldn't be treated once in the i loop
'my actions here
End If
Next J
End If
Next i
Here, when i debug, i see that the (i, 2) value is never set to 1, so my products are treated twice. I just can't understand why.
Thanks for your helps.