right mouse click and IF...Then
I have the following:(A2:A10) is defined as MyRange
Private Sub Worksheet_BeforeRightClick(ByVal Target As Excel.Range, Cancel As _ Boolean) If Application.Intersect(Target, Range("MyRange")) Is Nothing Then Exit Sub CommandBars("InputNameB").ShowPopup Cancel = True 'prevents normal Right-Click menu from appearing End Sub This works properly as is. I have two CommandBars; InputNameA & InputNameB. I would like to show InputNameA when cell A1 is right-mouse clicked and InputNameB when any other cell in "MyRange" is right-mouse clicked. I would like to accomplish this without removing A1 from "MyRange". Suggestions? |
right mouse click and IF...Then
Private Sub Worksheet_BeforeRightClick(ByVal Target As Excel.Range, Cancel
As Boolean) If Not Application.Intersect(Target, Range("MyRange")) Is Nothing Then If Target.Address = "$A$1" Then CommandBars("InputNameA").ShowPopup Else CommandBars("InputNameB").ShowPopup End If Cancel = True 'prevents normal Right-Click menu from appearing End If End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Matt" wrote in message ... I have the following:(A2:A10) is defined as MyRange Private Sub Worksheet_BeforeRightClick(ByVal Target As Excel.Range, Cancel As _ Boolean) If Application.Intersect(Target, Range("MyRange")) Is Nothing Then Exit Sub CommandBars("InputNameB").ShowPopup Cancel = True 'prevents normal Right-Click menu from appearing End Sub This works properly as is. I have two CommandBars; InputNameA & InputNameB. I would like to show InputNameA when cell A1 is right-mouse clicked and InputNameB when any other cell in "MyRange" is right-mouse clicked. I would like to accomplish this without removing A1 from "MyRange". Suggestions? |
right mouse click and IF...Then
Private Sub Worksheet_BeforeRightClick(ByVal Target As Excel.Range, _
Cancel As Boolean) If Application.Intersect(Target, Range("MyRange")) Is Nothing Then _ Exit Sub If Target.Address = "$A$1" then CommandBars("InputNameA").ShowPopup else CommandBars("InputNameB").ShowPopup end if Cancel = True 'prevents normal Right-Click menu from appearing End Sub -- Regards, Tom Ogilvy "Matt" wrote in message ... I have the following:(A2:A10) is defined as MyRange Private Sub Worksheet_BeforeRightClick(ByVal Target As Excel.Range, Cancel As _ Boolean) If Application.Intersect(Target, Range("MyRange")) Is Nothing Then Exit Sub CommandBars("InputNameB").ShowPopup Cancel = True 'prevents normal Right-Click menu from appearing End Sub This works properly as is. I have two CommandBars; InputNameA & InputNameB. I would like to show InputNameA when cell A1 is right-mouse clicked and InputNameB when any other cell in "MyRange" is right-mouse clicked. I would like to accomplish this without removing A1 from "MyRange". Suggestions? |
right mouse click and IF...Then
This works when I test in a blank workbook, but it doesn't when I use in my
existing workbook. Any suggestions? "Bob Phillips" wrote: Private Sub Worksheet_BeforeRightClick(ByVal Target As Excel.Range, Cancel As Boolean) If Not Application.Intersect(Target, Range("MyRange")) Is Nothing Then If Target.Address = "$A$1" Then CommandBars("InputNameA").ShowPopup Else CommandBars("InputNameB").ShowPopup End If Cancel = True 'prevents normal Right-Click menu from appearing End If End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Matt" wrote in message ... I have the following:(A2:A10) is defined as MyRange Private Sub Worksheet_BeforeRightClick(ByVal Target As Excel.Range, Cancel As _ Boolean) If Application.Intersect(Target, Range("MyRange")) Is Nothing Then Exit Sub CommandBars("InputNameB").ShowPopup Cancel = True 'prevents normal Right-Click menu from appearing End Sub This works properly as is. I have two CommandBars; InputNameA & InputNameB. I would like to show InputNameA when cell A1 is right-mouse clicked and InputNameB when any other cell in "MyRange" is right-mouse clicked. I would like to accomplish this without removing A1 from "MyRange". Suggestions? |
right mouse click and IF...Then
Thanks Bob - I had InputnameA ... when I changed it to InputNameA, it
remedied the situation. "Matt" wrote: This works when I test in a blank workbook, but it doesn't when I use in my existing workbook. Any suggestions? "Bob Phillips" wrote: Private Sub Worksheet_BeforeRightClick(ByVal Target As Excel.Range, Cancel As Boolean) If Not Application.Intersect(Target, Range("MyRange")) Is Nothing Then If Target.Address = "$A$1" Then CommandBars("InputNameA").ShowPopup Else CommandBars("InputNameB").ShowPopup End If Cancel = True 'prevents normal Right-Click menu from appearing End If End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Matt" wrote in message ... I have the following:(A2:A10) is defined as MyRange Private Sub Worksheet_BeforeRightClick(ByVal Target As Excel.Range, Cancel As _ Boolean) If Application.Intersect(Target, Range("MyRange")) Is Nothing Then Exit Sub CommandBars("InputNameB").ShowPopup Cancel = True 'prevents normal Right-Click menu from appearing End Sub This works properly as is. I have two CommandBars; InputNameA & InputNameB. I would like to show InputNameA when cell A1 is right-mouse clicked and InputNameB when any other cell in "MyRange" is right-mouse clicked. I would like to accomplish this without removing A1 from "MyRange". Suggestions? |
right mouse click and IF...Then
Yeah, the commandbars are case sensitive.
-- HTH RP (remove nothere from the email address if mailing direct) "Matt" wrote in message ... Thanks Bob - I had InputnameA ... when I changed it to InputNameA, it remedied the situation. "Matt" wrote: This works when I test in a blank workbook, but it doesn't when I use in my existing workbook. Any suggestions? "Bob Phillips" wrote: Private Sub Worksheet_BeforeRightClick(ByVal Target As Excel.Range, Cancel As Boolean) If Not Application.Intersect(Target, Range("MyRange")) Is Nothing Then If Target.Address = "$A$1" Then CommandBars("InputNameA").ShowPopup Else CommandBars("InputNameB").ShowPopup End If Cancel = True 'prevents normal Right-Click menu from appearing End If End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Matt" wrote in message ... I have the following:(A2:A10) is defined as MyRange Private Sub Worksheet_BeforeRightClick(ByVal Target As Excel.Range, Cancel As _ Boolean) If Application.Intersect(Target, Range("MyRange")) Is Nothing Then Exit Sub CommandBars("InputNameB").ShowPopup Cancel = True 'prevents normal Right-Click menu from appearing End Sub This works properly as is. I have two CommandBars; InputNameA & InputNameB. I would like to show InputNameA when cell A1 is right-mouse clicked and InputNameB when any other cell in "MyRange" is right-mouse clicked. I would like to accomplish this without removing A1 from "MyRange". Suggestions? |
All times are GMT +1. The time now is 08:16 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com