View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default BeforeDoubleClick doesn't seem to work

Another thing - in the syntax for the function, Target is supposed to be a
range. However, Target contains the value of the cell that was dbl-clicked.
Not the range as I expected.
I need to determine the cell name that was dbl clicked, then determine if
the cell is inside a specific range or not.

Why is Target the cell value, not it's range?

Thanks -

"Dan" wrote:

Thanks Nick -
My top left combo box doesn't contain anything other than "(General)", and
the right one has all of my subs listed, but nothing else.
How do I get these combo boxes to give me other options?
Thanks!

"NickHK" wrote:

Dan,
You cannot make up events and expect Excel to fire them. It is best to let
Excel create the routine stubs for you to ensure they are correct.
On the worksheet module, select Worksheet from the top-left combo box then
select the required event from the top-right combo box.
See the difference:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
MsgBox "Range= " & Target
End Sub

Also, I avoid using default properties. Be explicit.
It looks like you want
Target.Address
but you are getting
Target.Value

NickHK

"Dan" wrote in message
...
I have this code in my project, and double clicking on the sheet doesn't
appear to do anything:

Public Sub BeforeDoubleClick(ByVal SelRange As Range, Cancel As Boolean)
Cancel = True
msgbox "Range= " & SelRange
End Sub

What am I doing wrong?

Thanks -
Dan