View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Vasant Nanavati Vasant Nanavati is offline
external usenet poster
 
Posts: 1,080
Default Macro: search word, select row, copy.

Not sure I completely understand, but here goes:

With Cells.FindNext(ActiveCell).EntireRow
.Interior.ColorIndex = 6
.Interior.Pattern = xlSolid
.Copy
End With

Unless there is a rare and specific need, there is no need to select the
row.
__________________________________________________ ______________________


"Raul" wrote in message
...

I'm tryingo to write a macro in excel which:

-Finds a word in the file
-Selects the row which contains the word
-Changes the color of the row
-Copy the entire row

I have this:

Cells.FindNext(After:=ActiveCell).Activate
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Selection.Copy
End Sub


but i can't seem to figure out how to select only the row which contains
the
word. If I select the entire row, the macro will always copy that same row
['
Rows(4)' will select always row 4. 'Rows' will select all the rows...]

Comments?