Cells Right Click Menu Problem

J

Jack Gillis

I have added the following code to my Personal.XLS.

Sub Create_Unlock_Cells_Right_Click()
'Set up Unlock Cells on Right Click Menu
With Application.CommandBars("Cell").Controls.Add(, , , 6, (temporary))
.BeginGroup = True
.Caption = "Unlock Cells"
.OnAction = "Unlock_Cells"
End With
End Sub

Its purpose is to add a 'Unlock Cells' item to the right click menu for
cells. The subroutine "Unlock_Cells" simply unlocks the cell or range of
cells selected and works just like I want it to work.

The 'Unlock Cells' item appears on the right click menu any time I right
click on a cell or range of cells except for one case. That case occurs
when I select a complete row or column by selecting the row or column by
clicking on the row number at the far left or on the column designation at
the top of the worksheet. If I hover the mouse over any cell in the
selected row or column, the 'Unlock Cells" item is not present when I right
click.

Is there something I can add to the code that will cause the 'Unlock Cells'
item to be on the right click menu in this case?

Thank you very much.
 
A

Andy Pope

Hi,

That's because the Row and Column right clicks are a different commandbar

application.CommandBars("Row")
application.CommandBars("Column")

You also need to add you control to these two.

Cheers
Andy
 
J

Jack Gillis

Thank you very much. That did the trick.


Andy Pope said:
Hi,

That's because the Row and Column right clicks are a different commandbar

application.CommandBars("Row")
application.CommandBars("Column")

You also need to add you control to these two.

Cheers
Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top