+ Reply to Thread
Results 1 to 3 of 3

Help with VBA Code (Hide/Unhide Worksheets)

  1. #1
    Registered User
    Join Date
    06-12-2013
    Location
    Fairbury NE
    MS-Off Ver
    Excel 2007
    Posts
    70

    Help with VBA Code (Hide/Unhide Worksheets)

    I have the code below to open and close worksheets, but am running into an error and was hoping someone could help. The code works fine when I run it in a blank workbook, but doesn't work when I modify the sheet numbers to the workbook I want to put it into. I'm not real familiar with VBA and wondered if it had something to do with the Pivot Tables in the worksheets or if there is something else wrong.

    My code is:

    Hide and Unhide Sheets.png

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Help with VBA Code (Hide/Unhide Worksheets)

    Without seeing the actual workbook, I'd guess that the sheet doesn't exist.

    I use this in one of my projects:

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor thameem127's Avatar
    Join Date
    04-06-2012
    Location
    Jeddah,Saudi Arabia
    MS-Off Ver
    Excel 2003,Excel 2007
    Posts
    321

    Re: Help with VBA Code (Hide/Unhide Worksheets)

    change your code like this
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. vba to hide/unhide worksheets with conditions
    By short_n_curly in forum Excel General
    Replies: 2
    Last Post: 09-14-2012, 05:13 AM
  2. Hide Unhide worksheets conditionally
    By ufopilot3 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-19-2012, 11:32 AM
  3. hide and unhide worksheets
    By pankaj2145 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-27-2009, 07:26 PM
  4. Macro to Hide/Unhide Worksheets
    By incognito in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-15-2007, 03:18 AM
  5. Hide and/or Unhide Worksheets
    By Rob in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-13-2006, 04:35 PM

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