+ Reply to Thread
Results 1 to 3 of 3

VBA Tab Scrolling

Hybrid View

  1. #1
    Registered User
    Join Date
    06-10-2011
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2003
    Posts
    2

    VBA Tab Scrolling

    I've used a simple macro and application.onkey to make it so that I only have to press Page Up or Page Down to scroll through my excel tabs.

    My only problem is that I don't know how to identify the first and last tab in VBA ( I get an error message if I try to scroll past the first or last tab).

    Thanks in advance for the help!

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,663

    Re: VBA Tab Scrolling

    I've used a simple macro and...(oops, I forgot to post it)
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    06-10-2011
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: VBA Tab Scrolling

    Here's my attempt, it works but it's not pretty.


    Sub Tab_Scroll_Up()

    Dim x As Variant

    x = Worksheets(1).Name

    If ActiveSheet.Name = x Then
    ActiveSheet.Select
    Else
    ActiveSheet.Previous.Select
    End If


    End Sub
    Sub Tab_Scroll_Down()

    Dim x As Variant
    Dim y As Variant


    x = Worksheets.Count
    y = Worksheets(x).Name

    If ActiveSheet.Name = y Then
    ActiveSheet.Select
    Else
    ActiveSheet.Next.Select
    End If


    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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