View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Howard Howard is offline
external usenet poster
 
Posts: 536
Default Double click fails to run the code, just selects the cell

If I double click any one of these cell of this line of code, the double click just selects that cell, cursor blinking and cell in the edit mode.

If Target.Address = "$G$14,$G$36,$G$58,$G$80" Then

Each of these cells contain a Vlookup formula:

=IF(ISERROR(VLOOKUP(G7,$AJ$4:$AL$43,3,0)),"",VLOOK UP(G7,$AJ$4:$AL$43,3,0))

and will return a blank cell, or one of these strings, Notes_1, Notes_2 or Notes_3

I think my "If Target.Address =" line is the culprit. I have made the code work with a single "If Range("G14").Value = "Notes_1" Then" statement.

Thanks.
Howard

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim MyIntl As String
Dim MyNote As String

MyNote = Target.Value

If Target.Address = "$G$14,$G$36,$G$58,$G$80" Then
MyIntl = InputBox("Enter your Initials :", "Read Notes.")
If Len(MyIntl) = 0 Then
MsgBox "Enter your initials to read notes", vbCritical
Else
Cells(Rows.Count, "AN").End(xlUp).Offset(1, 0) = MyIntl
Cells(Rows.Count, "AN").End(xlUp) _
.Offset(0, 1) = MyNote & " " & Format(Now(), "dd/MM/yyy hh:mm AMPM")
If Target.Value = "Notes_1" Then MsgBoxNotes_1
If Target.Value = "Notes_2" Then MsgBoxNotes_2
If Target.Value = "Notes_3" Then MsgBoxNotes_3
End If
Cancel = True
End If

End Sub