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
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