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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

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