Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default doubleclick event only works once

Hello!
I posted this question a week ago but I never received the confirmation
email and I can't find it when I search the community.
Basically I have a problem with a doubleclick event.
I run the following macro (by doubleclicking) to call one of two macros.
Private Sub Worksheet_BeforeDoubleClick(ByVal _
Target As Range, Cancel As Boolean)
Dim dcCell As Range

If Target.Value 0 Then

If Target.Column = 1 Then

Call POtoContract(dcCell:=Target)
Cancel = True
Else
If Target.Column = 4 Then
Cancel = True
Call copytableline(cyCell:=Target)

End If
End If
End If
End Sub

If macro POtoContract is called then the user is prompted to enter the a
name and if he enters a wrong name then the sub exits (which is what it
should do). However, trying to doubleclick again to call the macro a second
time now enters editing mode instead of calling the macro again. Why?
If On the other hand the user does not enter a wrong name then POtoContract
runs till the end and double clicking still works after that.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default doubleclick event only works once

I'm not sure what your POtoContract and copytableline procedures are doing.
Is that code possibly stopping the macro and not allowing the Cancel
parameter from being set to True? Try putting the Cancel = True line before
you call your other procedures. The code below worked fine for me. Post the
code for the procedures I mentioned if this doesn't help. Hope this helps!
If so, let me know, click "YES" below.

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

If Target.Value 0 Then

If Target.Column = 1 Then
Cancel = True
Call POtoContract(dcCell:=Target)
Else
If Target.Column = 4 Then
Cancel = True
Call copytableline(cyCell:=Target)
End If
End If
End If

End Sub
--
Cheers,
Ryan


"goodfish" wrote:

Hello!
I posted this question a week ago but I never received the confirmation
email and I can't find it when I search the community.
Basically I have a problem with a doubleclick event.
I run the following macro (by doubleclicking) to call one of two macros.
Private Sub Worksheet_BeforeDoubleClick(ByVal _
Target As Range, Cancel As Boolean)
Dim dcCell As Range

If Target.Value 0 Then

If Target.Column = 1 Then

Call POtoContract(dcCell:=Target)
Cancel = True
Else
If Target.Column = 4 Then
Cancel = True
Call copytableline(cyCell:=Target)

End If
End If
End If
End Sub

If macro POtoContract is called then the user is prompted to enter the a
name and if he enters a wrong name then the sub exits (which is what it
should do). However, trying to doubleclick again to call the macro a second
time now enters editing mode instead of calling the macro again. Why?
If On the other hand the user does not enter a wrong name then POtoContract
runs till the end and double clicking still works after that.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default doubleclick event only works once

Hi Ryan Thanks for your help!
I managed to find the previous post through my communities profile (for some
reason I am not receiving email notifications and I cannot find the posts by
running a search) and OssieMac had pointed out that I might have enable
events = false in the called macro...which I did.
Thanks again.

"Ryan H" wrote:

I'm not sure what your POtoContract and copytableline procedures are doing.
Is that code possibly stopping the macro and not allowing the Cancel
parameter from being set to True? Try putting the Cancel = True line before
you call your other procedures. The code below worked fine for me. Post the
code for the procedures I mentioned if this doesn't help. Hope this helps!
If so, let me know, click "YES" below.

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

If Target.Value 0 Then

If Target.Column = 1 Then
Cancel = True
Call POtoContract(dcCell:=Target)
Else
If Target.Column = 4 Then
Cancel = True
Call copytableline(cyCell:=Target)
End If
End If
End If

End Sub
--
Cheers,
Ryan


"goodfish" wrote:

Hello!
I posted this question a week ago but I never received the confirmation
email and I can't find it when I search the community.
Basically I have a problem with a doubleclick event.
I run the following macro (by doubleclicking) to call one of two macros.
Private Sub Worksheet_BeforeDoubleClick(ByVal _
Target As Range, Cancel As Boolean)
Dim dcCell As Range

If Target.Value 0 Then

If Target.Column = 1 Then

Call POtoContract(dcCell:=Target)
Cancel = True
Else
If Target.Column = 4 Then
Cancel = True
Call copytableline(cyCell:=Target)

End If
End If
End If
End Sub

If macro POtoContract is called then the user is prompted to enter the a
name and if he enters a wrong name then the sub exits (which is what it
should do). However, trying to doubleclick again to call the macro a second
time now enters editing mode instead of calling the macro again. Why?
If On the other hand the user does not enter a wrong name then POtoContract
runs till the end and double clicking still works after that.

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
how to use selectionchange instead of doubleclick event? ghost Excel Discussion (Misc queries) 0 December 24th 08 05:00 AM
Doubleclick event programming Jim[_72_] Excel Programming 2 April 11th 08 09:44 PM
Help with "Doubleclick event" Les Excel Programming 2 December 6th 07 06:28 PM
Multi select with doubleclick event matelot Excel Programming 3 April 25th 07 05:36 AM
Date Doubleclick Event PG Oriel Excel Programming 2 February 14th 06 11:49 AM


All times are GMT +1. The time now is 04:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"