View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
kmwhitt kmwhitt is offline
external usenet poster
 
Posts: 36
Default Msgbox Code Help Please....

You are a GENIUS!!! I can't thank you enough! Works 100%....

Thanks,

Kevin

"JLatham" wrote:

Yes, that code most definitely has something to do with it. Without changing
it, it always places a checkmark in F6 when you double-click there.

Here's my modification of it , as a complete replacement.

What I've done is add a second check to see if the contents of C5 contains
"MDF" (uppercase) anywhere in it at all. If it does NOT then the message
pops up AND then checkmark in F6 is erased. But if "MDF..." was found in C5,
nothing really happens (checkmark remains).

Finally, I added a Cancel=True statement to bounce you out of those cells
when you double-click on them rather than leaving you in them in edit mode.
Just delete that line if you really want to stay in there.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)

Application.EnableEvents = False
On Error GoTo sub_exit
If Not Intersect(Target, Range("D12:G549,F5:F8")) Is Nothing Then
With Target
If .Value = "a" Then
.Value = ""
Else
.Value = "a"
.Font.Name = "Marlett"
End If
End With

'new code to add
If Not Intersect(Target, Range("F6")) Is Nothing Then
If InStr(UCase(Range("C5")), "MDF") = 0 Then
Target.Value = "" ' erase check mark?
MsgBox "This option is not availabe for " & _
Range("C5") & ". Please change the doorstyle " & _
"to MDF Painted to proceed."
End If
End If
' remove if you want to remain in the
' double-clicked cell
Cancel = True
End If

sub_exit:
Application.EnableEvents = True
End Sub

"kmwhitt" wrote:

When a user double clicks on cell F6 one of two things can happen based upon
whether or not the text in cell C5 contains the string "MDF":

1) If "MDF" is found within C5, a check mark is placed in the cell. I
already have code set up to place a Marlette check box in several different
cells including this one.

2) If "MDF" is not found within C5, an error message pops up and states",
This option is not availabe for (actual contents of C5). Please change the
doorstyle to MDF Painted to proceed.

Would someone please help me write this code?

Thanks,

Kevin