Thread: Highlight Cells
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Highlight Cells

That code works for me on a brand new workbook. Is your worksheet protected???
--
HTH...

Jim Thomlinson


"ranswrt" wrote:

I would like to highlight a line of cells when the cell is selected. I tried
the following code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range
Dim ycell As Range

Set ycell = ActiveCell.EntireRow.Cells(3)
Set rng = Range(ycell, ycell.Offset(0, 5))
rng.Interior.ColorIndex = 36

End Sub

but I get an error that says 'Unable to set ColorIndex property of the
interior class'.
What am I doing wrong here? or is there a better way to do this?
Thanks