View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ManicMiner17 ManicMiner17 is offline
external usenet poster
 
Posts: 30
Default HOW TO APPLY GRAY HIGHLIGHTING TO RANGE, BASED ON ENTRY IN ONECELL

On 26/08/2010 17:04, Dave K wrote:
Hello, i am attempting to apply gray shading to the range i12:w12,
based on the cell g12. That is, if cell g12 contains the word "yes", i
want the cells i12 thru w12 to be highlighted gray.

Is there a simple way to accomplish that result?

Thanks for any suggestions.


Hi Dave,

You could put this in the worksheet's code module:

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = Range("$G$12").Address And _
Range("$G$12").Value ="yes" Then

Range("I12:W12").Interior.ColorIndex = 15

End If

End Sub