View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Lazzzx Lazzzx is offline
external usenet poster
 
Posts: 24
Default Macro / vb query

Hi,

This code will highlight (yellow background) columns 1 to 7 (A:G) in the row
where activecell is.

With ActiveCell.End(xlToLeft).Resize(1, 7)
.Interior.ColorIndex = 6
.Interior.Pattern = xlSolid
End With

if the left column of your table is not column A, you can add an offset. Eg,
this will highlight columns C:I

With ActiveCell.End(xlToLeft).Resize(1, 7).Offset(0, 2)
.Interior.ColorIndex = 6
.Interior.Pattern = xlSolid
End With

With this code it does not matter in which column you find the word you are
searching for.

regards
Lazzzx


"Dan Thompson" <Dan skrev i meddelelsen
...
I am trying to set up a macro that will find a row based on a specific
word,
then underline that row in the table.

I've tried recording it, and the find bit is fine, but I don't know how to
change the vb code to allow it to highlight columns 1 through 7 on the row
that has been found. At the moment, the code points to specific cells:

Range("A7:E7").Select

Any ideas please?

Thanks, Dan.