ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   worksheet_beforerigthclick event (https://www.excelbanter.com/excel-programming/370527-worksheet_beforerigthclick-event.html)

R..VENKATARAMAN

worksheet_beforerigthclick event
 
I have a code like this

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
Target.Offset(0, 1) = Target

End Sub

in spite of cancel=true statement when I right click the target, the submenu
comes up and so the event code does not work. where is the mistake.




Don Guillett

worksheet_beforerigthclick event
 
the cancel=true shouldn't be necessary but you will need to put in the SHEET
module instead of a regular module or ThisWorkbook module

--
Don Guillett
SalesAid Software

"R..VENKATARAMAN" wrote in message
...
I have a code like this

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
Target.Offset(0, 1) = Target

End Sub

in spite of cancel=true statement when I right click the target, the
submenu comes up and so the event code does not work. where is the
mistake.






Dave Peterson

worksheet_beforerigthclick event
 
Is the code behind the correct worksheet?

Have you disabled events and not re-enabled them?



"R..VENKATARAMAN" wrote:

I have a code like this

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
Target.Offset(0, 1) = Target

End Sub

in spite of cancel=true statement when I right click the target, the submenu
comes up and so the event code does not work. where is the mistake.


--

Dave Peterson

Dave Peterson

worksheet_beforerigthclick event
 
If the OP doesn't want to see the Cell menu after rightclicking, won't he need
that "cancel = true" line?

Don Guillett wrote:

the cancel=true shouldn't be necessary but you will need to put in the SHEET
module instead of a regular module or ThisWorkbook module

--
Don Guillett
SalesAid Software

"R..VENKATARAMAN" wrote in message
...
I have a code like this

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
Target.Offset(0, 1) = Target

End Sub

in spite of cancel=true statement when I right click the target, the
submenu comes up and so the event code does not work. where is the
mistake.




--

Dave Peterson

Don Guillett

worksheet_beforerigthclick event
 
Yeah. my bad

--
Don Guillett
SalesAid Software

"Dave Peterson" wrote in message
...
If the OP doesn't want to see the Cell menu after rightclicking, won't he
need
that "cancel = true" line?

Don Guillett wrote:

the cancel=true shouldn't be necessary but you will need to put in the
SHEET
module instead of a regular module or ThisWorkbook module

--
Don Guillett
SalesAid Software

"R..VENKATARAMAN" wrote in message
...
I have a code like this

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
Target.Offset(0, 1) = Target

End Sub

in spite of cancel=true statement when I right click the target, the
submenu comes up and so the event code does not work. where is the
mistake.




--

Dave Peterson




[email protected]

worksheet_beforerigthclick event
 
thanks all of you. I checked again in a new workook the macro is ok.
previous time also I placed the macro only in the worksheet event
module nolt in the standard module.. But the excel sheet was sent by
somebody. I dont know whether he/she has done some enableevents .
anyhow it is ok in my sheet. thank you once again all of you. the doubt
is cleared.
venkat


Don Guillett wrote:
Yeah. my bad

--
Don Guillett
SalesAid Software

"Dave Peterson" wrote in message
...
If the OP doesn't want to see the Cell menu after rightclicking, won't he
need
that "cancel = true" line?

Don Guillett wrote:

the cancel=true shouldn't be necessary but you will need to put in the
SHEET
module instead of a regular module or ThisWorkbook module

--
Don Guillett
SalesAid Software

"R..VENKATARAMAN" wrote in message
...
I have a code like this

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
Target.Offset(0, 1) = Target

End Sub

in spite of cancel=true statement when I right click the target, the
submenu comes up and so the event code does not work. where is the
mistake.




--

Dave Peterson




All times are GMT +1. The time now is 12:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com