+ Reply to Thread
Results 1 to 4 of 4

Macro Button to go to specific sheet

Hybrid View

Mr.S 55 Macro Button to go to... 06-24-2013, 06:51 PM
mehmetcik Re: Macro Button to go to... 06-24-2013, 07:12 PM
mehmetcik Re: Macro Button to go to... 06-24-2013, 07:38 PM
mehmetcik Re: Macro Button to go to... 06-24-2013, 07:51 PM
  1. #1
    Registered User
    Join Date
    06-06-2013
    Location
    Irvine, CA
    MS-Off Ver
    Excel 2007
    Posts
    9

    Macro Button to go to specific sheet

    Hi,

    I am new to VBA and Macros. I am trying to create a button that takes you from a home page to a specified sheet. I need to make about 20 buttons. Any help in this matter would be much appreciated.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Macro Button to go to specific sheet

    Hi

    Firstly you probably do not need to do anything. Excel does that automatically.

    RIGHT CLICK your mouse cursor over the arrows at the bottom left of excel.

    A list of sheets will open select one to move there.

    Secondly I wrote the attached macros to do something similar.

    I will send them seperately.
    Last edited by mehmetcik; 06-24-2013 at 07:55 PM.

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Macro Button to go to specific sheet

    This macro creates a sheet called index and lists all the sheets in your workbook:

    Sub Contents()
    
    On Error GoTo 40
        Sheets("Index").Select
        
     GoTo 50
    40   Sheets.Add
         Sheets(ActiveSheet.Name()).Name = "Index"
         Sheets("Index").Move Before:=Sheets(1)
        GoTo 50
          
    50  Columns("A:A").Select
        Selection.ClearContents
        
    60  myshts = ActiveWorkbook.Sheets.count
    
    On Error GoTo 200
    
    100 For count = 1 To myshts
    
        Sheets(count).Select
    
        TEMP = ActiveSheet.Name
        Sheets("Index").Select
        Range("A" & count).Select
        ActiveCell.FormulaR1C1 = TEMP
      
        Next
        
    200     ' Exit
    End Sub

    This macro sorts all your workbook sheets to match your index.
    So if you want your sheets sorted alphabetically for example sort the index sheet and run this Macro.

    Sub Sortlist()
    
    On Error GoTo 200
    
       Sheets("Index").Select
        
    count = 1
    
    10 Sheets("Index").Select
        count = count + 1
    
        Target = Range("A" & count).Value()
        
        Sheets(Target).Select
        ActiveSheet.Move ActiveWorkbook.Sheets(count)
          
        Sheets("Index").Select
       
        GoTo 10
       
    200 ' END
    
    End Sub
    This next macro is quite powerful. I use ctrl g to run it.
    press ctrl g on any sheet,
    if it is used on the index sheet it will take you to the sheet named in the active row.
    On any other sheet it takes you to the Index Sheet.


    Sub GOTOSHEET()

    If ActiveSheet.Name() <> "Index" Then GoTo 100

    Range("A" & ActiveCell.Row()).Select

    Target = ActiveCell.Value()
    If Target = "" Then GoTo 200
    Sheets(Target).Select

    GoTo 200

    100 On Error goto 200

    Sheets("Index").Select

    200 ' exit

    End Sub


    Finally the attached file contains a file with an auto open macro. this can also be triggered using ctrl shift g.

    This opens a userform that lists all the sheets in your userform.

    Click on a sheet name to go there.

    Enjoy,
    Attached Files Attached Files
    Last edited by mehmetcik; 06-24-2013 at 07:41 PM.

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Macro Button to go to specific sheet

    Sorry

    I sent wrong userform.
    Attached Files Attached Files

+ 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