Deny Access To 'right-click' Attributes

Important Notice

Please note that on 14th December 2023 users will experience an expected outage whilst we make upgrades to our network. We anticipate this process may take a couple of hours and so we apologise in advance for any inconvenience.

  • Hi,

    Are the 2 examples the correct methods to prevent right-click on Rows and Columns?

    'Prevent Right Click on entire selected Row(s)

    Application.CommandBars("Row").Enabled = False

    'Prevent Right Click on entire selected Column(s)

    Application.CommandBars("Column").Enabled = False

    Thanks in advance,

  • Re: Deny Access To 'right-click' Attributes

    Hi DerbyNeal,

    Can you please tell me the original 2 command bars in your post?

    I have used the code in the post and you have removed it since then. I now cannot access the right click events for those bars.


  • Re: Deny Access To 'right-click' Attributes


    Are you saying that you have lost the ability to do this now, after you ran the code once?

    If so then try running


    Hopefully that'll give you them back.

    Of course, I may have totally misunderstood you, in which case I apologise for wasting your time! ;)


  • Re: Deny Access To 'right-click' Attributes

    Hi KJ,

    Thanks for the reply. Those were not the two original statements on the post. They were edited, but I had used the code and my machine crashed shortly afterwards (not because of the code) and I had not saved the file. I just need the original code before the post was edited.


  • Re: Deny Access To 'right-click' Attributes

    All yout Toolbar setting are stored in a special file (.xlb), unfortunately this has probably been lost or amended because of the crash. The best thing to do for future reference is to locate that .xlb and creat a backup. Mine is in

    C:\Documents and Settings\Roy Cox\Application Data\Microsoft\Excel

    You can try this to restore them

    Sub Restore() 
    Dim a As Integer 
    On Error Resume Next 
    With Application.CommandBars 
        .Item(1).Enabled = True 
        For a = 2 To Application.CommandBars.Count 
            .Item(a).Visible = Status(a) 
        Next a 
    End With 
    End Sub

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!