Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default RightClick Range

Hi there,

I've added a right click popup menu to a range ("Orders" = A15:E40) that
works fine (bar my other FaceID problem - see "FaceID not available" post
earlier today).

The problem is that if I right click on a row or column header the popup,
pops up which means I loose the standard context menu. Is there an
alternative to the Intersect function that would only detect a cell that's
in the range rather than a whole row that happens to run through the range?

Thanks in advance

John


Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
If Not Intersect(Range("Orders"), Target) Is Nothing Then
CommandBars("JohnsPopup").ShowPopup
Cancel = True
End If
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default RightClick Range

I'm guessing there is a lot of code out there with the same problem.
Probably some of mine too.
This seems to work...

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Not Target.Rows.Count = Me.Rows.Count Then
If Not Intersect(Range("Orders"), Target) Is Nothing Then
CommandBars("JohnsPopup").ShowPopup
Cancel = True
End If
End If
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"John"
wrote in message
Hi there,
I've added a right click popup menu to a range ("Orders" = A15:E40) that
works fine (bar my other FaceID problem - see "FaceID not available" post
earlier today).
The problem is that if I right click on a row or column header the popup,
pops up which means I loose the standard context menu. Is there an
alternative to the Intersect function that would only detect a cell that's
in the range rather than a whole row that happens to run through the range?
Thanks in advance
John


Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
If Not Intersect(Range("Orders"), Target) Is Nothing Then
CommandBars("JohnsPopup").ShowPopup
Cancel = True
End If
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default RightClick Range

Hi Jim,

Thanks very much for your reply. Prompted by your example I've decided to
go for:

If Target.Columns.Count = 1 And Target.Rows.Count = 1 Then

as that seems ok for my purpose.

Thanks for the workaround.

Best regards

John



"Jim Cone" wrote in message
...
I'm guessing there is a lot of code out there with the same problem.
Probably some of mine too.
This seems to work...

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
If Not Target.Rows.Count = Me.Rows.Count Then
If Not Intersect(Range("Orders"), Target) Is Nothing Then
CommandBars("JohnsPopup").ShowPopup
Cancel = True
End If
End If
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"John"
wrote in message
Hi there,
I've added a right click popup menu to a range ("Orders" = A15:E40) that
works fine (bar my other FaceID problem - see "FaceID not available" post
earlier today).
The problem is that if I right click on a row or column header the popup,
pops up which means I loose the standard context menu. Is there an
alternative to the Intersect function that would only detect a cell that's
in the range rather than a whole row that happens to run through the
range?
Thanks in advance
John


Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
If Not Intersect(Range("Orders"), Target) Is Nothing Then
CommandBars("JohnsPopup").ShowPopup
Cancel = True
End If
End Sub




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default RightClick Range

here's what i use, not saying it's the best way, but works for me

If Target.Count = 1 Then
If Not Intersect(Target, Columns("e")) Is Nothing Then
If Worksheets("call report").ProtectContents = True Then

--


Gary


"John" wrote in message
...
Hi there,

I've added a right click popup menu to a range ("Orders" = A15:E40) that works
fine (bar my other FaceID problem - see "FaceID not available" post earlier
today).

The problem is that if I right click on a row or column header the popup, pops
up which means I loose the standard context menu. Is there an alternative to
the Intersect function that would only detect a cell that's in the range
rather than a whole row that happens to run through the range?

Thanks in advance

John


Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
If Not Intersect(Range("Orders"), Target) Is Nothing Then
CommandBars("JohnsPopup").ShowPopup
Cancel = True
End If
End Sub



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default RightClick Range

Thanks Gary. I hadn't thought about just using Target.Count.

Yet another way! Thanks again.

John


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
here's what i use, not saying it's the best way, but works for me

If Target.Count = 1 Then
If Not Intersect(Target, Columns("e")) Is Nothing Then
If Worksheets("call report").ProtectContents = True Then

--


Gary


"John" wrote in message
...
Hi there,

I've added a right click popup menu to a range ("Orders" = A15:E40) that
works fine (bar my other FaceID problem - see "FaceID not available" post
earlier today).

The problem is that if I right click on a row or column header the popup,
pops up which means I loose the standard context menu. Is there an
alternative to the Intersect function that would only detect a cell
that's in the range rather than a whole row that happens to run through
the range?

Thanks in advance

John


Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
If Not Intersect(Range("Orders"), Target) Is Nothing Then
CommandBars("JohnsPopup").ShowPopup
Cancel = True
End If
End Sub







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default RightClick Range

and i use the protectcontents = true so it only works when the sheet's
protected. if it's unprotected, the right click context menu is displayed

--


Gary


"John" wrote in message
...
Thanks Gary. I hadn't thought about just using Target.Count.

Yet another way! Thanks again.

John


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
here's what i use, not saying it's the best way, but works for me

If Target.Count = 1 Then
If Not Intersect(Target, Columns("e")) Is Nothing Then
If Worksheets("call report").ProtectContents = True Then

--


Gary


"John" wrote in message
...
Hi there,

I've added a right click popup menu to a range ("Orders" = A15:E40) that
works fine (bar my other FaceID problem - see "FaceID not available" post
earlier today).

The problem is that if I right click on a row or column header the popup,
pops up which means I loose the standard context menu. Is there an
alternative to the Intersect function that would only detect a cell that's
in the range rather than a whole row that happens to run through the range?

Thanks in advance

John


Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
If Not Intersect(Range("Orders"), Target) Is Nothing Then
CommandBars("JohnsPopup").ShowPopup
Cancel = True
End If
End Sub







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default RightClick Range

if target.cells.count = 1 then

would be equivalent

John wrote:

Hi Jim,

Thanks very much for your reply. Prompted by your example I've decided to
go for:

If Target.Columns.Count = 1 And Target.Rows.Count = 1 Then

as that seems ok for my purpose.

Thanks for the workaround.

Best regards

John

"Jim Cone" wrote in message
...
I'm guessing there is a lot of code out there with the same problem.
Probably some of mine too.
This seems to work...

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
If Not Target.Rows.Count = Me.Rows.Count Then
If Not Intersect(Range("Orders"), Target) Is Nothing Then
CommandBars("JohnsPopup").ShowPopup
Cancel = True
End If
End If
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"John"
wrote in message
Hi there,
I've added a right click popup menu to a range ("Orders" = A15:E40) that
works fine (bar my other FaceID problem - see "FaceID not available" post
earlier today).
The problem is that if I right click on a row or column header the popup,
pops up which means I loose the standard context menu. Is there an
alternative to the Intersect function that would only detect a cell that's
in the range rather than a whole row that happens to run through the
range?
Thanks in advance
John


Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
If Not Intersect(Range("Orders"), Target) Is Nothing Then
CommandBars("JohnsPopup").ShowPopup
Cancel = True
End If
End Sub



--

Dave Peterson
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
Rightclick mousebutton desktop hangs !!!!!!!!!!!!!! [email protected] Excel Discussion (Misc queries) 3 April 30th 06 08:53 AM
Changing RightClick event handling GeyserPeak[_2_] Excel Programming 1 July 27th 05 04:39 AM
Before RightClick event change broogle Excel Programming 6 June 30th 05 03:57 AM
Add Command to RightClick Menu Ronbo Excel Programming 3 January 14th 05 02:05 AM
worksheet tab - rightclick choices Tom Ogilvy Excel Programming 0 July 17th 03 08:53 PM


All times are GMT +1. The time now is 08:35 PM.

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"