Copying Row

  • Thread starter Thread starter Shaz
  • Start date Start date
S

Shaz

Hello
The code below does almost what I want - identifying words within a
sheet. I would like however to copy the entire row to Sheet2 when
found - can someone help with the coding?
Thanks in advance

Sub FindCode()

Dim astrList(5) As String
Dim lngUpperBound As Long
Dim strText As String
Dim lngIndex As Long
Dim lngRow As Long

'set the upperbound of the array
'(number of words it'll contain)
lngUpperBound = 3

'add words to the array
astrList(0) = "boB"
astrList(1) = "George"
astrList(2) = "woRd"
astrList(3) = "match?"
astrList(4) = "YES"

'look for any matches in col1
For lngRow = 10 To 100
strText = UCase(ActiveSheet.Cells(lngRow, 1).Value)
For lngIndex = 0 To lngUpperBound - 1
If UCase(astrList(lngIndex)) = strText Then

'I can't get the following line to work

EntireRow.Copy
Sheets("Sheet2").Range("A65000").End(xlUp).Offset(1, 0)

End If
Next
Next
End Sub
 
Shaz

I think you need:

Cells(lngRow, 1).EntireRow.Copy
Sheets("Sheet2").Range("A65000").End(xlUp).Offset(1, 0)

Regards

Trevor
 
Hi
This macro looks really useful.
Is there a way of say listing the words I want it to look for onto a
separate sheet (sheet2?) and have it "cycle" through that list?
What adaptation would be required?
Your help is much much appreciated.

Sammy
 
Back
Top