+ Reply to Thread
Results 1 to 6 of 6

Command for moving to the next visible sheet

  1. #1
    Registered User
    Join Date
    11-06-2016
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    9

    Command for moving to the next visible sheet

    Hi,

    I would like to create a command button that shows the next active sheet.

    normally I use codes ActiveSheet.Next.Select and ActiveSheet.Previous.Select for showing next and previous sheet.

    Let's say that out of sheets 2, 3, 4, and 5, only one is visible depending on the variable of the same name as the next visible sheet shown in a cell of the sheet 1.

    What code can I use to move to that next visible sheet?

    Thanks

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Command for moving to the next visible sheet

    I'm not sure I understand what you mean.

    Would you upload an example workbook and say which sheet is active when you want to run the macro and what sheet should be active afterwards?
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    11-06-2016
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    9

    Re: Command for moving to the next visible sheet

    sheet "Walls" is followed by four sheets: "Flat Roof", "Monopitch Roof", "Duopitch Roof" and "Hipped Roof".

    Only one of them is visible depending on the value selected from drop-down list in the sheet "Wind Pressures".

    Command buttons NEXT and PREVIOUS use codes ActiveSheet.Next.Select and ActiveSheet.Previous.Select.

    Command button NEXT in the sheet "Walls" needs to navigate user to the sheet that is visible from the four sheets "Flat Roof", "Monopitch Roof", "Duopitch Roof" and "Hipped Roof".

    The same applies for the PREVIOUS command button in the "Overall Force" sheet.
    Attached Files Attached Files

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,893

    Re: Command for moving to the next visible sheet

    Take a look at this link

    http://www.ozgrid.com/forum/showthread.php?t=76578

    Two solutions near the end of the post
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Registered User
    Join Date
    11-06-2016
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    9

    Re: Command for moving to the next visible sheet

    Thanks, it is working for the NEXT button.

    I changed the code for the PREVIOUS button to
    Please Login or Register  to view this content.

    but it is only working when HIPPED ROOF is selected
    Last edited by alansidman; 12-10-2016 at 08:03 PM.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,893

    Re: Command for moving to the next visible sheet

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Vba to name Command Buttons based on Visible Sheets
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-04-2016, 12:50 AM
  2. Is it possible? To hide a command button and after being sent it can turn visible
    By gongi in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 07-16-2015, 11:32 AM
  3. Replies: 4
    Last Post: 01-06-2014, 02:14 AM
  4. ActiveX command button visible through Chart
    By Richardza in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 08-12-2010, 10:00 AM
  5. Making one sheet visible once a Week or when command button is pressed
    By realniceguy5000 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-11-2008, 04:34 PM
  6. Command Button Always Visible in window
    By avveerkar in forum Excel General
    Replies: 2
    Last Post: 01-11-2006, 08:25 AM
  7. [SOLVED] How do I make a command button invisible or visible?
    By Mandora in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-18-2005, 10:06 AM

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