Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Code not working

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.

---
Regards,
Norman



"Jim May" wrote in message
...
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.






"Norman Jones" wrote:

Hi Jim,

If the option to enable editing in a cell is set, double clicking a cell
initiates the edit mode, with thecursor at the end of the cell. Pressing
the
Esc cancels the edit.

Similarly, in the BeforeDoubleclickcode, setting Cancel=True cancel the
edit
mode.

---
Regards,
Norman



"Jim May" wrote in message
...
Norman,
Thanks - I will try when I get back to my PC;
Can you phrase why the "Cancel = True" is
necessary - I haven't quite got this part down yet -
but will as soon as you provide me the understanding
Much appreciated,
Jim

"Norman Jones" wrote:

Hi Jim,

Try adding:

Cancel = True

before

End Sub


---
Regards,
Norman



"Jim May" wrote in message
news:qgzVe.23113$8q.10433@lakeread01...
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









Reply
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
Code not working and can't see why Steve Excel Discussion (Misc queries) 3 December 31st 04 03:12 PM
VB code is not working like it should Bob Reynolds[_3_] Excel Programming 8 July 19th 04 12:02 AM
Vb Code not working bob Excel Programming 3 January 5th 04 01:29 PM
why this code not working tj Excel Programming 0 September 2nd 03 07:14 PM
why this code not working Bernie Deitrick[_2_] Excel Programming 0 September 2nd 03 05:08 PM


All times are GMT +1. The time now is 12:45 PM.

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"