Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I'm using the following code within a Worksheet_Change function to
lock/clear and unlock a range of cells. There's also another bit of code in the function that forces uppercase for cell F3. If I type "YES" into cell F3 then the cells unlock just fine, but there's a problem when I try to clear the cell contents. If I select the cell and press "Delete" the contents ("YES") disappear but the Change event isn't triggered and the range D10:D16 don't lock. However, if I select the cell, press Backspace then Enter then the Change event triggers and D10:d16 lock just fine. So it seems that the Delete key press doesn't constitute an Event. Is that normal? Can anyone think of a workaround? Using Excel 2003. If Target.Address = "$F$3" And UCase(Target.Value) = "YES" Then ActiveSheet.Unprotect Password:="password" With Range("$D$10:$D$16") .Locked = False End With ActiveSheet.Protect Password:="jess" ElseIf Target.Address = "$F$3" And UCase(Target.Value) < "YES" Then ActiveSheet.Unprotect Password:="password" With Range("$D$10:$D$16") .ClearContents .Locked = True End With ActiveSheet.Protect Password:="jess" End If Thanks in advance. Grahame |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Disabling WORKSHEET_CHANGE event | Excel Discussion (Misc queries) | |||
Worksheet_change event handler error | Excel Discussion (Misc queries) | |||
Controling the Worksheet_Change Event? | Excel Discussion (Misc queries) | |||
Selectively Clearing cell contents | Excel Worksheet Functions | |||
Clearing Contents of Cell | Excel Worksheet Functions |