Loop problem

AlBilly

New Member
Joined
Aug 22, 2016
Messages
18
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

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
what happens when you step through with F8 and a watch on your values?
 
Upvote 0
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:
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,380
Members
448,955
Latest member
BatCoder

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top