# Loop problem

#### AlBilly

##### New Member
Hi,
I am puzzle with a for loop.
I need to check if the current row col A match current row + 1 col A and so forth for another 3 more column
I know that current row col A data differs from current row +1 col A but it get ignored at the end and I am trying to figure this one out. I am missing something but ???

current row : AA
current row +1 :AA
current row +2 : total

This is the loop I currently use
Code:
``````INumFin = 767
INumDep = 769
For i = INumFin To INumDep - 1
If Range("A" & INumFin).Value <> Range("A" & INumFin + 1).Value Then 'And _
'           Range("B" & INumFin) <> Range("B" & INumFin + 1) And _
'           Range("D" & INumFin) <> Range("D" & INumFin + 1) And _
'           Range("E" & INumFin) <> Range("E" & INumFin + 1) * -1 Then

iLgDiff = fDiff.Range("A1").CurrentRegion.Rows.Count + 1
'Copie des lignes trouvées vers la feuille Différences
Range("A" & INumFin & ":F" & INumDep).Copy fDiff.Range("A" & iLgDiff)
Range("E" & INumFin).Select
End If
Next i``````

thanks

Last edited:

### Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use \$ signs: \$V\$2:\$Z\$99 will always point to V2:Z99, even after copying

#### miless2111s

##### Active Member
what happens when you step through with F8 and a watch on your values?

#### AlBilly

##### New Member
the values are identical and I do not know why when it should be different
just found my problem, I need to put the counter in my if statement, not a fixed value

Last edited:

Replies
2
Views
377
Replies
8
Views
410
Replies
6
Views
3K
Replies
15
Views
551
Replies
4
Views
325

1,190,657
Messages
5,982,137
Members
439,757
Latest member
85Sarah2005

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back