Looping until the last row in sheet - copy cell i until last colmn

KNKN9

Board Regular
Joined
Mar 27, 2017
Messages
92
Hi and thanks,


Data set

Col A Col B Col C Col D Col E Col F Col G
Row 1 x x x x x x x
[TABLE="width: 4615"]
<colgroup><col><col><col><col><col><col><col span="2"><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Row 2 x x x x x x x
Row 3 x x x x x x x
Row 4 x x x x x x x[/TD]
[TD][/TD]
[TD]

[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I need to copy each row separately ( baring in mind my data my not always start in row 1 so the row starting point is unknown. I need to do this until the last row so in this case row 4.

I am only able to do this if I know my starting row I am struggling to get this done when not knowing the starting row.

I have the code below

Code:
For i = 79 To LastRow
    Range(i, Rng).Copy
    Next i
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
I don't know what you have in Rng, but the row number i must be in cells(i, x) or in Range(x & i)

Maybe something like this:

Code:
  LastRow = Range("A" & Rows.Count).End(xlUp).Row
  For [B][COLOR=#FF0000]i[/COLOR][/B] = LastRow To 1 Step -1
    If Cells([SIZE=3][B][COLOR=#ff0000]i[/COLOR][/B][/SIZE], Rng).Value = "" Then Exit For
    Range(Rng & [B][COLOR=#FF0000]i[/COLOR][/B]).Copy
  Next i
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,250
Members
452,623
Latest member
Techenthusiast

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