Loop ActiveRow issue

geospatial

Active Member
Joined
Sep 2, 2008
Messages
290
Currently using the below code which breaks at
Code:
Row(iRow).Select

I am trying to find out how you can remember which row you were on in the loop and then after pasting to Sheet1 you can come back and select your current row in the loop before it offsets.


Code:
 Sub LoopTest()
      ' Select cell A2, *first line of data*.
      Range("A10").Select
      ' Set Do loop to stop when an empty cell is reached.
      Do Until IsEmpty(ActiveCell)
            iRow = ActiveCell.Row
            ActiveCell.EntireRow.Copy Destination:=Sheets("WebTas Table Export").Range("A1")
            Sheets("Sheet1").Select
        Range("A1").Select
        Sheets("WebTAS Table Export").Range("A9:AI14996").advancedFilter Action:= _
        xlFilterCopy, CriteriaRange:=Range("'WebTAS Table Export'!Criteria"), _
        CopyToRange:=Range("A1"), Unique:=False
        
        Sheets("WebTAS Table Export").Select
        Row(iRow).Select
         ' Insert your code here.
         ' Step down 1 row from present location.
         ActiveCell.Offset(1, 0).Select
      Loop
   End Sub
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Not sure what you are trying to do with the rest of your code, but the line that breaks should be:

Rows(iRow).Select
 
Upvote 0
Thanks,

I had realized that after posting. I do have it working now, but had to change Activecell.select to activecell.address. Activecell.select only gave me a true and not the address itself
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,588
Members
449,039
Latest member
Arbind kumar

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