LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Clearing Cell Contents / Worksheet_Change Event

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disabling WORKSHEET_CHANGE event Jase Excel Discussion (Misc queries) 1 April 25th 08 04:32 PM
Worksheet_change event handler error gen Excel Discussion (Misc queries) 0 January 18th 08 04:55 AM
Controling the Worksheet_Change Event? DCSwearingen Excel Discussion (Misc queries) 3 May 25th 06 08:32 PM
Selectively Clearing cell contents jdd Excel Worksheet Functions 2 April 22nd 06 04:06 AM
Clearing Contents of Cell Burt Excel Worksheet Functions 1 May 4th 05 02:46 PM


All times are GMT +1. The time now is 09:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"