Macro copies the same row instead of going to the next one

Status
Not open for further replies.

Ossian13

New Member
Joined
Oct 21, 2016
Messages
46
Hello guys,

im using this code
Code:
Sub etc

xLastRow = Range("A" & Rows.Count).End(xlUp).Row

For i = 1 To xLastRow
    Columns("AO:AT").Select
    Selection.Find(What:="Michael", After:=ActiveCell, LookIn:=xlFormulas, _
        LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False).Activate
   ActiveCell.EntireRow.Copy Sheets("OnlyV").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
    
   Next
end sub
The code is much bigger but only this part is the trouble. So, my code looks for the name "Michael" starting from column AO to column AT, and where he finds this string it copies the entire row to another sheet. But the issue is that the macro copies the same row over and over again instead of going to the next one. Could anyone tell me what is the missing part?

Thank you,
Ossian.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Status
Not open for further replies.

Forum statistics

Threads
1,215,528
Messages
6,125,342
Members
449,218
Latest member
Excel Master

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