+ Reply to Thread
Results 1 to 8 of 8

Need Macro for moving to different sheets

  1. #1
    Registered User
    Join Date
    04-23-2012
    Location
    dubai
    MS-Off Ver
    Excel 2007
    Posts
    11

    Need Macro for moving to different sheets

    Hi All,

    I have a Excel Work book having 3 sheets, Sheet1 Sheet2 and Sheet3.
    I have a macro which will do if we click on the button 2 in Sheet 1 it moves to sheet 2 and click on button 3 in sheet1 then to sheet 3.
    And when we click on back button from sheet 2 and sheet 3 it will come back to sheet1.

    What i need is i want to hide both 2 sheets (sheet 2 and sheet 3) once i click button 2 then sheet 2 should be vissible and like for button 3.
    Again if i click back button from sheet 2 and sheet 3 should come back to sheet1 and both sheets 2 and 3 should go invisible.

    Can anyone add to below macro so that it will work as above.
    Please Login or Register  to view this content.
    Aneesh M
    Last edited by arlu1201; 04-23-2012 at 09:53 AM. Reason: Please put code tags in future.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need Macro for moving to different sheets

    Please Login or Register  to view this content.

    You can use this as the base code to create a macro to goto any sheet, just change the name of the new macro and the highlighted target sheet reference. This macro would go into a normal code module (Insert > Module).
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    04-23-2012
    Location
    dubai
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Need Macro for moving to different sheets

    Thanks a lot but still my requirement not met.

    First Sheet is my menu sheet where i have 4 buttons.
    what i need is that all these 4 buttons should linked to 4 sheets of same workbook,so that if i click on the buttons it should direct me to the sheet linked.
    Also except menu sheet all other sheets should be invisible.And once i click the button the linked sheet should get visible.There will be a back button on that linked sheet and if i click that the sheet should return back to menu sheet .

    Can you help me to make a macro for this.

    Aneesh M

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need Macro for moving to different sheets

    Yes, I just showed you how to do your first button in post #2. That macro would go on a button intended to activate a sheet called "Sheet2". I even highlighted the part of the code you would need to edit.

    To create the code for your next button, copy the code, change the name, edit the sheet to the next target worksheet, then attach it to your second button.

    Repeat ad nauseum.

    On each of your target sheets, you would have a "back" button attached to a macro that does the exact same thing, it's just that the name of the macro will be different and the sheet name will point back to the main sheet.

    It's remarkably simple. Once you have edited the code given above to work on your first button, it will be clearer.

  5. #5
    Registered User
    Join Date
    04-23-2012
    Location
    dubai
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Need Macro for moving to different sheets

    This is Awesome!!!!

    Thank you So much

    Regards,
    Aneesh

  6. #6
    Registered User
    Join Date
    04-23-2012
    Location
    dubai
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Need Macro for moving to different sheets

    One more how can i make buttons for different excel files instead of sheets in the same file

    Please help

    Aneesh M

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need Macro for moving to different sheets

    That's a completely different creature. Worthy of it's own Q&A. Start a new thread with appropriate title and supporting descriptions of your working environment, sheet names, paths, etc. re: Creating buttons to switch from one workbook to another


    Please select Thread Tools from menu above and set this topic to SOLVED.

  8. #8
    Registered User
    Join Date
    04-23-2012
    Location
    dubai
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Need Macro for moving to different sheets

    Ok Thank you so much.
    I will make a new thread.

    Aneesh

+ 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