Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can you use ActiveWorkbook.unprotect under Sub Worksheet?
-----Original Message----- Wrap it in Unprotect, Protect Sub Worksheet_SelectionChange(ByVal target As Range) If Range("C23") < 8 Then ActiveWorkbook.UnProtect Password := "Your password here ' if no pass word, just use ActiveWorkbook.UnProtect Range("C8:C22").Interior.ColorIndex = 6 Else Range("C8:C22").Interior.ColorIndex = 44 End If ActiveWorkbook.Protect Password := "Your password here" End Sub ----- 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 Help Sub Worksheet_SelectionChange(ByVal target As Range) If Range("C23") < 8 Then Range("C8:C22").Interior.ColorIndex = 6 Else Range("C8:C22").Interior.ColorIndex = 44 End If End Sub . |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ColorIndex | Excel Worksheet Functions | |||
colorindex | Excel Discussion (Misc queries) | |||
ColorIndex | Excel Programming | |||
ColorIndex | Excel Programming |