Code not working

  • Thread starter Thread starter Jim May
  • Start date Start date
J

Jim May

If I use BeforeDoubleclick (below) on a cell in Column A
say a5 (which contains a formula Row()-1), XL thinks I want to edit the
formula throwing me into Edit mode VERSUS running the below code - Also
trying Before RightClick, causes my shortcut menu to come up, probably for
same reason. I need to "turn-off" something here,, but what?


Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Target.Column = 1 Then
Load frmPOReq
With frmPOReq
.txtSeqNo.Value = Target.Value
.txtDate.Value = Target.Offset(0, 1).Value
.txtEmpCode.Value = Target.Offset(0, 2).Value
.txtAmt.Value = Target.Offset(0, 3).Value
End With
End If
End Sub
 
Thanks, Norman;
I thought the Cancel = True << canceled the Event dead in its tracks.

As I understand (things)..
Having as I do this BeforeDoubleClick << Event..

When I Double Click a cell anywhere in my activesheet (to which I have the
code attached) it FIRES the event. The event once FIRED "says" I noticed
that you just
doubleclicked on my sheet - you wish for me to do something for you "just
ahead" of your Click - WHAT? write the code for what you want me to do.
In my case I have said if I doubleclick a cell in Column A then Load and
populate a Userform; If I doubleclick in a cell of Column B:IV then do
nothing.

Now, if I add the line Cancel = True (before the End Sub line) this is
equivalent to saying STOP - DO NOT PROCEED - Abort the Event.. I'll forget
that you even double-click my sheet. Have a nice day!!

I don't see the connection between the Cancel = True being to cancel the
Edit Mode.

Can you (from the above) straighten me out?
Thanks in Advance.
 
Hi Jim,

Setting Worksheet_BeforeDoubleClick's Cancel parameter to True cancels the
edit mode, it does not exit the procedure. In consquence, the edit mode is
cancelled, but code within the procedure runs.
 
Back
Top