+ Reply to Thread
Results 1 to 12 of 12

Right click sheet menu

  1. #1
    Registered User
    Join Date
    06-08-2005
    Location
    Kildare, Ireland
    MS-Off Ver
    Windows/Office 365
    Posts
    41

    Right click sheet menu

    Would anyone have code to allow the sheets in a workbook to be selected from the right click menu?
    Des M

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Right click sheet menu

    You can right-click on the |<< >>| buttons to the left of the sheet tabs for a list of sheets you can select. Did you want different functionality?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    06-08-2005
    Location
    Kildare, Ireland
    MS-Off Ver
    Windows/Office 365
    Posts
    41

    Right click sheet menu

    Thanks, but I know about the right click on <<>>. It would be better for me to have the selection list on the right click menu when I right click anywhere.
    Des M

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    There's a free addin to create a toolbar that allows navigation to sheets here

    http://www.excel-it.com/vba_examples.htm
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    06-08-2005
    Location
    Kildare, Ireland
    MS-Off Ver
    Windows/Office 365
    Posts
    41

    Right click sheet menu

    Thanks Roy.
    I downloaded the addin and it's good but I would like to be able to select from the right click menu because it is faster than having to pick from a dropdown.
    DesM

  6. #6
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,641
    Hi there,

    Have I understood correctly - you want to be able to right-click anywhere on a worksheet, display a dropdown list containing the names of all the visible worksheets, and then move automatically to the selected one?

    Regards,

    Greg M

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    H
    Here you are

    The code below should be placed in Private Module of the Workbook Object (ThisWorkbook); right click on the Excel icon, top left next to File and choose View Code.

    Please Login or Register  to view this content.
    This is the navgate code, place it in a Standard module

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    06-08-2005
    Location
    Kildare, Ireland
    MS-Off Ver
    Windows/Office 365
    Posts
    41
    RoyUK, thanks indeed for this and it works perfectly.
    Besides solving my problem I'm trying to use it to improve my VBA. I have managed to put a divider line on top of the first sheet entry (and not get it above them all. I used IF and ws.index).
    I'm now trying to put a tick mark beside the selected sheet. I have managed to get the tick mark to show (CommandBars.ActionControl.State = msoButtonDown) but I can't get it to cancel when I select another sheet. Any hints?

    Greg M: thanks for replying. I was just about to respond when I got RoyUK's answer which solved the problem.

    Thanks again, DesM

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I have amended the code, the code below should be placed in Private Module of the Workbook Object (ThisWorkbook); right click on the Excel icon, top left next to File and choose View Code.


    Please Login or Register  to view this content.
    In a Standard Module
    Please Login or Register  to view this content.

  10. #10
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,641
    Hi Roy,

    Many thanks for that very interesting code.

    May I suggest the following small addition to the "ThisWorkbook" module:

    Please Login or Register  to view this content.
    This will ensure that the "Selected Sheet" checkbox is updated even if the user navigates via the worksheet tabs or Ctrl+Page Up/Down.

    Best regards,

    Greg M

  11. #11
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Good idea Greg

  12. #12
    Registered User
    Join Date
    06-08-2005
    Location
    Kildare, Ireland
    MS-Off Ver
    Windows/Office 365
    Posts
    41
    Roy, thanks for the revised code. I see that it puts a tick box in the menu items. Is it possible to just use the msobuttonup/down to place a tick beside the item?
    I think that to remove them I should loop through the items in the menu making its "state" = msobuttonup. Can't figure out how to look through the menu items.
    However, thanks very much for your help.
    Greg, thanks too for that extra bit of code.
    Des

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1