+ Reply to Thread
Results 1 to 4 of 4

VBA code to open next sheet or go back to previous

Hybrid View

ABSTRAKTUS VBA code to open next sheet... 10-14-2010, 06:44 AM
Richard Buttrey Re: VBA code to open next... 10-14-2010, 06:51 AM
ABSTRAKTUS Re: VBA code to open next... 10-14-2010, 07:18 AM
royUK Re: VBA code to open next... 10-14-2010, 07:21 AM
  1. #1
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    VBA code to open next sheet or go back to previous

    Hi Gurus,

    I have a spreadsheet lets say with ten sheets in it. Is there a possibility (of course there is) to have a "Next" and "Back" buttons on each of them. The point is instead of clicking on next or previous tab, I'd like to do that with buttons. Thoughts?

  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: VBA code to open next sheet or go back to previous

    Hi,

    Untested but something like

    Sub GotoNextSheet
       Sheets(ActiveSheet.Index + 1).Activate
    
    End Sub
    and similar for a GotoPreviousSheet but with a - 1
    HTH
    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
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: VBA code to open next sheet or go back to previous

    Thanks a ton. Its so easy...

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

    Re: VBA code to open next sheet or go back to previous

    Alternative

    Option Explicit
    
    Sub x()
    ActiveSheet.Next.Select
    End Sub
    Sub y()
    ActiveSheet.Previous.Select
    End Sub
    Hope that helps.

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

    Free DataBaseForm example

+ 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