![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Apr 2002
Posts: 113
|
Direct from the excel help:
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, _ ByVal Target As Range, ByVal Cancel As Boolean) Cancel = True End Sub I placed this in "ThisWorkbook" but I get the error: "Compile Error: Event procedure declaration does not match description of event having the same name." Similar stuff happens a lot when I try to use examples from the help, there is often something that needs to be adjusted. Is there some global problem that I'm not catching, or is it simply isolated mistakes in the Help files? What I want to do: I added an item to the cell shortcut menu, but it is only applicable on one sheet of one workbook. So I need some event that will disable it if any other sheet or workbook is right-clicked. Regards, Brian Ideally, |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: Sydney/Brisbane , Australia
Posts: 539
|
copy that macro. then right click on the worksheet tab you want the code used in.
select view code. and now paste it in there. |
|
|
|
|
|
#3 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
should be; Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Cancel = True End Sub If only one sheet then use the sheets event code eg Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean) End Sub |
|
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
Actually, that's an interesting question for the topic. Why are the VBA examples so poorly defined and varaibles are declared as variants mostly for convenience. Is there any particular reason, or are these people just like everyone else? You know, knock something up quick and move on to the next topic.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|