Copy multiple rows

Philip041

Board Regular
Joined
Jul 17, 2011
Messages
63
Hi,

I have a league table of data 9 columns wide. The blocks of data are separated by two blank lines. Above each block in column A is a name and then in the tenth column, so just above to the right of the block of data, is a median.

I was trying to do something which went: if a cell in column B is empty copy the row below it, so that I copy the name and the median. I have written this based on bits copied off this forum but it doesn't work. It runs through copying all the rows I want but after it has run only the first row is copied. I'm also worried it is copying the row just below the one I want as well as the one I want:


Sub Copy_Indices()

Dim LR As Long, i As Long
LR = Range("B" & Rows.Count).End(xlUp).Row
For i = LR To 2 Step -1
If Range("B" & i).Value = "" Then Rows(i + 1).Select
Application.CutCopyMode = False
Selection.copy

Next i

End Sub

I hope my explanation makes sense.

Many thanks in advance for any help.

Here is sort of what my data looks like:

Name Median
Data Data Data Data Data Data
Data Data Data Data Data Data
Data Data Data Data Data Data
Data Data Data Data Data Data
Data Data Data Data Data Data

Name Median
Data Data Data Data Data Data
Data Data Data Data Data Data
Data Data Data Data Data Data

Name Median
Data Data Data Data Data Data
Data Data Data Data Data Data
Data Data Data Data Data Data
Data Data Data Data Data Data

But the medians are to the right of the data.

The amount of data in a block isn't set...


Cheers,

Philip
 

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)

Watch MrExcel Video

Forum statistics

Threads
1,129,553
Messages
5,636,989
Members
416,953
Latest member
broexc

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
Top