PDA

View Full Version : dissable richt click page setup



wilg
04-03-2011, 09:47 PM
Is there a way to dissable the right click & page set up? I still want to be able to right click, but conditionally turn off page setup availability when right clicked.

Thanks.

mbm123
04-04-2011, 04:24 AM
I hope this will help

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True 'disables the right click menu'

** your code here**

end sub

wilg
04-04-2011, 05:57 AM
hi mbm123, I need this to happen due to a specific cell > a given number. If that cell = 10 as an example I want to dissable all possibilities of page set up. I currently hide the toolbar which renders using that option unavailable, but if they right click, they are able to select page setup fro that.

So I need to dissable the right click based on criteria.

mbm123
04-04-2011, 06:13 AM
In that case just add an If statement


Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
if range("YOUR CELL").value > NUM then
Cancel = True 'disables the right click menu'
end if
** your code here**

End Sub



Did i understand it right?

wilg
04-04-2011, 07:11 AM
Ahhh, that works. Thanks you