ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   BeforeDoubleClick (https://www.excelbanter.com/excel-programming/402752-beforedoubleclick.html)

Stefi

BeforeDoubleClick
 
Hi All,

I have a
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
event procedure which worked well. I couldn't determine what happened, but
now it doesn't work, because Target is False and not a Range. What went wrong
and how could I fix it?

Thanks,
Stefi


Dave D-C[_3_]

BeforeDoubleClick
 
.. because Target is False and not a Range.
This can't be right. (can it?)
Do: Msgbox Target.Address

But I have found out that doing a
Userform1.Show
in a BeforeDoubleClick routine will leave the doubleclicked
cell in 'Edit' or 'Enter' mode, which causes me problems.
It's as if EnableEvents becomes false, but I'm not setting it.

My workaround is to end the routine with
Sendkeys "{ESC}"
I am XL97/WIN98

My workaround seems hoky.
Can somebody address this (related) issue?

Stefi wrote:
I have a
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range,
Cancel As Boolean)
event procedure which worked well. I couldn't determine what happened,
but now it doesn't work, because Target is False and not a Range.
What went wrong and how could I fix it?




Dave Peterson

BeforeDoubleClick
 
The event looks like:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)

You can just use:

Cancel = true 'to stop from going into edit mode.

(same thing with the _beforerightclick event.

Dave D-C wrote:

.. because Target is False and not a Range.

This can't be right. (can it?)
Do: Msgbox Target.Address

But I have found out that doing a
Userform1.Show
in a BeforeDoubleClick routine will leave the doubleclicked
cell in 'Edit' or 'Enter' mode, which causes me problems.
It's as if EnableEvents becomes false, but I'm not setting it.

My workaround is to end the routine with
Sendkeys "{ESC}"
I am XL97/WIN98

My workaround seems hoky.
Can somebody address this (related) issue?

Stefi wrote:
I have a
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range,
Cancel As Boolean)
event procedure which worked well. I couldn't determine what happened,
but now it doesn't work, because Target is False and not a Range.
What went wrong and how could I fix it?


--

Dave Peterson

Dave Peterson

BeforeDoubleClick
 
By chance did you create a variable named Target--a boolean variable on top of
that?

Stefi wrote:

Hi All,

I have a
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
event procedure which worked well. I couldn't determine what happened, but
now it doesn't work, because Target is False and not a Range. What went wrong
and how could I fix it?

Thanks,
Stefi


--

Dave Peterson

Dave D-C[_3_]

BeforeDoubleClick
 
I used to think that "Thank you"s and "Your welcome"s were
just contributing noise and wasting bandwidth. But I was wrong.

Thank you. (and .. and .. and ..) Dave D-C

Dave Peterson wrote:
The event looks like:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
You can just use:
Cancel = true 'to stop from going into edit mode.
(same thing with the _beforerightclick event.


Dave D-C wrote:
But I have found out that doing a
Userform1.Show
in a BeforeDoubleClick routine will leave the doubleclicked
cell in 'Edit' or 'Enter' mode, which causes me problems.
It's as if EnableEvents becomes false, but I'm not setting it.

My workaround is ..
Can somebody address this (related) issue?



Stefi

BeforeDoubleClick
 
Hi Dave,

I definitely didn't do that. I'm afraid I came across an Excel bug, because
checking again my BeforeDoubleClick sub it seems to work again without
touching it in any way. As far as I know, users have no influence on
arguments of event routins (except in the way you supposed, but it's not the
case in my problem), they are internal affairs of Excel. The annoying thing
is that I can't determine the cause of this phenomenon thus I can't avoid
actions triggering this kind of behaviour.

Do you have any advice?

Thanks,
Stefi


€žDave Peterson€ť ezt Ă*rta:

By chance did you create a variable named Target--a boolean variable on top of
that?

Stefi wrote:

Hi All,

I have a
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
event procedure which worked well. I couldn't determine what happened, but
now it doesn't work, because Target is False and not a Range. What went wrong
and how could I fix it?

Thanks,
Stefi


--

Dave Peterson


Jim Rech[_2_]

BeforeDoubleClick
 
I'm afraid I came across an Excel bug

It's always tempting to conclude that but most of the time it's not an Excel
bug, especially in a feature that's been around since Excel 97 and you're
the first to encounter it some 10 years later.

I'd love to see an reproducible example, and if you can send me one, you'll
have my abject apologies for ever doubting you.<g

--
Jim
"Stefi" wrote in message
...
| Hi Dave,
|
| I definitely didn't do that. I'm afraid I came across an Excel bug,
because
| checking again my BeforeDoubleClick sub it seems to work again without
| touching it in any way. As far as I know, users have no influence on
| arguments of event routins (except in the way you supposed, but it's not
the
| case in my problem), they are internal affairs of Excel. The annoying
thing
| is that I can't determine the cause of this phenomenon thus I can't avoid
| actions triggering this kind of behaviour.
|
| Do you have any advice?
|
| Thanks,
| Stefi
|
|
| "Dave Peterson" ezt írta:
|
| By chance did you create a variable named Target--a boolean variable on
top of
| that?
|
| Stefi wrote:
|
| Hi All,
|
| I have a
| Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As
| Boolean)
| event procedure which worked well. I couldn't determine what happened,
but
| now it doesn't work, because Target is False and not a Range. What
went wrong
| and how could I fix it?
|
| Thanks,
| Stefi
|
| --
|
| Dave Peterson
|



Stefi

BeforeDoubleClick
 
Hi Jim,

I thought of a bug because I didn't find any other explanation for the
phenomenon. Of course it's possible that I made a mistake or there was an
error in my computer's operation. My problem is that I can't reproduce the
error, it disappeared without any change in the code. I keep trying to
reproduce the error and I'll send a copy to you if I get a positive result.

Thanks and best regards,
Stefi



€žJim Rech€ť ezt Ă*rta:

I'm afraid I came across an Excel bug


It's always tempting to conclude that but most of the time it's not an Excel
bug, especially in a feature that's been around since Excel 97 and you're
the first to encounter it some 10 years later.

I'd love to see an reproducible example, and if you can send me one, you'll
have my abject apologies for ever doubting you.<g

--
Jim
"Stefi" wrote in message
...
| Hi Dave,
|
| I definitely didn't do that. I'm afraid I came across an Excel bug,
because
| checking again my BeforeDoubleClick sub it seems to work again without
| touching it in any way. As far as I know, users have no influence on
| arguments of event routins (except in the way you supposed, but it's not
the
| case in my problem), they are internal affairs of Excel. The annoying
thing
| is that I can't determine the cause of this phenomenon thus I can't avoid
| actions triggering this kind of behaviour.
|
| Do you have any advice?
|
| Thanks,
| Stefi
|
|
| "Dave Peterson" ezt Ă*rta:
|
| By chance did you create a variable named Target--a boolean variable on
top of
| that?
|
| Stefi wrote:
|
| Hi All,
|
| I have a
| Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As
| Boolean)
| event procedure which worked well. I couldn't determine what happened,
but
| now it doesn't work, because Target is False and not a Range. What
went wrong
| and how could I fix it?
|
| Thanks,
| Stefi
|
| --
|
| Dave Peterson
|





All times are GMT +1. The time now is 11:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com