I have a problem in selecting several ranges of cells. What i wish to do is to look at some data and identify where a certain cell occurs. In this case it contains the text "Calshot". I then want to select this cell and the 8 cells above it. The macro searches for all of these ranges ( down one column). Once selected i wish to copy and paste to another sheet. However, I can't seem to get the macro to select all the ranges of cells.
So far I have this:
Sub copydata()
Do
If ActiveCell = ("Calshot") Then
Range("Calshot").Offset(-8, 0).Select
With Selection.Interior
.ColorIndex = 35
.Pattern = xlSolid
End With
End If
ActiveCell.Offset(1, 0).Select
Loop Until IsEmpty(ActiveCell.Offset(1, 0))
End Sub
which doesn't work. The problem lies with the 'Range' line of code. If i remove this the macro runs and selects every cell containing the word "Calshot". I just can't select a range of cells based upon this one cell which appears at irregular points down the column.
So far I'm just experimenting so I'm filling the cells with colour to check it's working. copying and pasting is not a problem.
Any help would be much appreciated.
Luke
Bookmarks