+ Reply to Thread
Results 1 to 3 of 3

Hide/Unhide sheets with key combination

  1. #1
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Hide/Unhide sheets with key combination

    Hi all,

    is there a way to hide/unhide several sheets at once with just one key combo? I'd like to press e.g. ctrl+r and make sheet 1,2 and 3 get hidden. The next time I'd press ctrl+r they would become visible again (all sheets will be visible/hidden at the same time).

    I know how to make it one way or another, but I cannot think of a code to do both at once.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Hide/Unhide sheets with key combination

    Assuming that you have atleast 1 sheet visible at all times (excel does not allow all sheets to be hidden), try this code -
    Please Login or Register  to view this content.

    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    Choose Insert | Module
    Where the cursor is flashing, choose Edit | Paste

    To run the Excel VBA code:
    Choose View | Macros
    Select a macro in the list, and click the Run button

    To assign a key combination to the macro -
    Go to View | Macros
    Click on Options and assign the key.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: Hide/Unhide sheets with key combination

    Thanks for the code! I'll give it a try just after i post this message Thanks for the instructionos how to create a macro(although unnecessary I appreciate you taking your time). Big thanks!

+ 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