right click

J

Jonathan Cooper

Can a 'right click' menu be changed? I'd like to add some things

For example, I'd like to select some cells then right click on the selection and convert it to values

Also, I've recorded a macro that converts a selection to values, but it's probably not the most efficient way to do it. What's the easiest way to convert a selection to values through a macro?
 
E

Erin

This macro would add the ability to bring up the sort
wizard from the right click menu. I took the basic idea
from John Walkenbach's book Excel 2000 Power Programming
with VBA. For more information check out his book (there
are new books for the newer versions of Excel). You also
may be able to find more info at his website www.j-
walk.com.

Sub AddItemsToPopup()

Set newItem = CommandBars("cell").Controls.Add
With newItem
.Caption = "Sort"
.OnAction = "Reference.ShowSortWizard"
.BeginGroup = True
End With

End Sub
-----Original Message-----
Can a 'right click' menu be changed? I'd like to add some things.

For example, I'd like to select some cells then right
click on the selection and convert it to values.
Also, I've recorded a macro that converts a selection to
values, but it's probably not the most efficient way to do
it. What's the easiest way to convert a selection to
values through a macro?
 
E

Erin

Sorry I forgot to add the other piece of the puzzle which
tells Excel what to do when that option is selected on
from the right click menu. In the code I posted
previously the line .OnAction = "Reference.ShowSortWizard"
is referencing this code which was in a module called
Reference.

Sub ShowSortWizard()

On Error Resume Next
Application.Dialogs(xlDialogSort).Show

End Sub
 
Top