Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 516
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 516
Default 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?




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 516
Default 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?






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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?





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
Right Mouse Click StephenD Excel Discussion (Misc queries) 4 May 27th 09 04:24 PM
Each Click of the Mouse D.Parker Excel Discussion (Misc queries) 13 April 28th 05 11:24 PM
Mouse Over Graph, Capture Information on Click(Double Click) Dean Hinson[_3_] Excel Programming 1 December 6th 04 04:49 AM
Send mouse click? Johan Johansson Excel Programming 1 November 16th 04 10:28 PM
get value of a cell with a mouse click Ken Wright Excel Programming 0 July 22nd 03 07:15 PM


All times are GMT +1. The time now is 04:57 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"