View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Case Statement - help required

Assuming you don't have merged cells involved, then your code in all 3
instances appears to be consistent. If one works, they all should work.

further assuming your case is promulgated on the address of Target, then if
Target is a single cell, $C$3 then,

If the ElseIf in question never gets called, then
a) does C4 contain only two characters and those characters are "PH" (case
sensitive)
and C3 contains neither "Yes" nor "No"

--
Regards,
Tom Ogilvy


"deelee" wrote:


I'm aware I seem to be double posting but I'm desperate for help with
this script.

My problem is the second ElseIf - it doesn't do what I think it should
- perhaps what I'm doing is classed an illegal?

Your help and advice is always welcome:

Case "$C$3" 'Monday

'Non-working day
If Target.Value = "No" Then
ActiveSheet.Unprotect ("MyPassword")
Range("C:C").Locked = True
Range("$C$3").Locked = False
ActiveSheet.Protect ("MyPassword")

'Working Day
ElseIf Target.Value = "Yes" Then
ActiveSheet.Unprotect ("MyPassword")
Range("$C$6:$C$10,$C$16:$C$20,$C$26:$C$30,$C$36:$C
$40,$C$46:$C$50").Locked = False
ActiveSheet.Protect ("MyPassword")

'Public Holiday
ElseIf Target.Offset(1, 0) = "PH" Then
ActiveSheet.Unprotect ("MyPassword")
Range("$C$6:$C$10").Locked = True
ActiveSheet.Protect ("MyPassword")

EndIf

Thanks again

Dave


--
deelee
------------------------------------------------------------------------
deelee's Profile: http://www.excelforum.com/member.php...o&userid=34866
View this thread: http://www.excelforum.com/showthread...hreadid=551127