Pop Up Menu Demonstration

How to create and implement a popup menu


The code is in one VBA module:
  • PopUpMenu

and in the following worksheet module:

  • WorksHere
In the VBA module "PopUpMenu" run "RunMeToGetThingsGoing".

Or press the button "Click here to set up the Pop Up menu"
Now switch to the "WorksHere" sheet and right click on any cell.

There are two options on the popup menu; both run the same macro, which displays a message.

This workbook covers two areas:
  1. Creating a popup menu
  2. Using the Right_Click event

The popup menu is in the VBA module "PopUpMenu".

The main procedure is called "CreateSubMenu". There are also some supporting procedures.

The module for the "WorksHere" sheet contains one procedure:

  • Worksheet_BeforeRightClick

When you are in the "WorksHere" sheet, this procedure runs each time you click on the right mouse button. It runs the popup menu, allows you to make a selection and then closes.

To stop the default popup menu running, we include the line:

  • Cancel = True