VBA distinguish between right click and left click

hobgoblinvasya

Board Regular
Joined
Jun 29, 2005
Messages
215
hi guys

i've been using excel for a while but this problem simply baffles me. i have a popup calendar that shows every time a user clicks on a certain cell. however i dont want it to popup if the user right-clicks on that cell. is there a way in vba to distinguish between when the user left clicked his mouse or right clicked?

thanks in advance
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
When you say it kicks off when a user clicks on a cell what event code are you using to detect this?

Dom
 
Upvote 0
You probably have a WorkSheet_SelectionChange event that triggers the calendar when this cell is selected. Unfortunately, a Right click involves selecting the cell, thus getting the pop-up. I suggest you fine the code. RightClick the sheet tab and Choose "View Code". Replace this line
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
wit
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
This will now require a DoubleClick to call the calendar.
HTH
lenze
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,267
Members
448,558
Latest member
aivin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top