+ Reply to Thread
Results 1 to 4 of 4

Hide sheet based on yes/no cell

  1. #1
    Registered User
    Join Date
    01-28-2010
    Location
    Fareham
    MS-Off Ver
    Excel 2003
    Posts
    9

    Hide sheet based on yes/no cell

    Hi, I am trying to hide/unhide a single worksheet based on the yes/no result of a cell in a second worksheet. I'm a VBA newbie but so far I have:

    Please Login or Register  to view this content.
    This works 90% of the time but every now and again I'll change another cell on the worksheet and it will bin out with an error code. Any help as to what I can change?

  2. #2
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: Hide sheet based on yes/no cell

    Move the Address test and Value test to separate lines:

    Please Login or Register  to view this content.
    Richard
    Richard Schollar
    Microsoft MVP - Excel

  3. #3
    Registered User
    Join Date
    01-28-2010
    Location
    Fareham
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Hide sheet based on yes/no cell

    I have no idea why that works but many thanks!

  4. #4
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: Hide sheet based on yes/no cell

    The problem (usually) is if more than one cell is changed (ie so Target is more than one cell) - Target.Value then returns an array which will give you a type mismatch error when you compare it against a string (ie "Yes").

+ 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