Thread: ColorIndex
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Chris Chris is offline
external usenet poster
 
Posts: 244
Default ColorIndex

Wrap it in Unprotect, Protec

Sub Worksheet_SelectionChange(ByVal target As Range) If Range("C23") < 8 The
ActiveWorkbook.UnProtect Password := "Your password here ' if no pass word, just use ActiveWorkbook.UnProtec

Range("C8:C22").Interior.ColorIndex =
Els
Range("C8:C22").Interior.ColorIndex = 4
End I
ActiveWorkbook.Protect Password := "Your password here

End Su


----- Trevor Davidson wrote: ----

The Code below works just fine when the Worksheet is
unprotected
The problem starts when I protect the worksheet. All
cells in the code are unprotected
I get an error 1004

Please Hel

Sub Worksheet_SelectionChange(ByVal target As Range
If Range("C23") < 8 The
Range("C8:C22").Interior.ColorIndex =
Els
Range("C8:C22").Interior.ColorIndex = 4
End I
End Su