+ Reply to Thread
Results 1 to 5 of 5

Need a Macro/VBA that unhides a worksheet based on a cell

  1. #1
    Registered User
    Join Date
    12-19-2016
    Location
    United States
    MS-Off Ver
    2013
    Posts
    20

    Need a Macro/VBA that unhides a worksheet based on a cell

    Very new to VBA, help would be appreciated

    So I have a worksheet, named "WFIV", that is usually hidden in my format.

    I would like to unhide itself when I run the macro if cell T24 in worksheet "I" = "WFBR" .

    Most things I have researched have used a private sub, which will not let me run the macro for some reason. It is my understanding all macros dealing with worksheet use a private sub, so some explanation could help.

    If someone could write the code here that would be greatly appreciated.

    Thanks

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Need a Macro/VBA that unhides a worksheet based on a cell

    Hi,

    Create this procedure in a Module and then attach the procedure to a suitable button on the worksheet
    Please Login or Register  to view this content.
    Note it's better to use sheet VBA names rather than tab names which are too easily changed causing any macro that uses them to fall over. So better would be
    Please Login or Register  to view this content.
    Last edited by Richard Buttrey; 01-05-2017 at 07:29 PM.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,467

    Re: Need a Macro/VBA that unhides a worksheet based on a cell

    Hi there,

    See if the attached workbook gets you moving in the right direction.

    It uses the following code:

    Please Login or Register  to view this content.
    The highlighted values can be altered to suit your own requirements.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    12-19-2016
    Location
    United States
    MS-Off Ver
    2013
    Posts
    20

    Re: Need a Macro/VBA that unhides a worksheet based on a cell

    So there is over 100 sheets in this Excel, would using the name work best for this since sometimes new sheets are added or others are moved around?

  5. #5
    Registered User
    Join Date
    12-19-2016
    Location
    United States
    MS-Off Ver
    2013
    Posts
    20

    Re: Need a Macro/VBA that unhides a worksheet based on a cell

    It says there is something wrong with the If line and needs to be debugged, any suggestions?

+ 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. [SOLVED] Improving a macro, so that it either hides, or unhides all the columns
    By davidx in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 11-11-2015, 05:00 AM
  2. Need Help writing a VBA for a worksheet calculate event that hides/unhides rows
    By cmitc013 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-13-2015, 10:56 AM
  3. Macro to select worksheet based on cell value and then return data to diff worksheet
    By clnossok in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-22-2013, 07:48 PM
  4. [SOLVED] an answer in one cell unhides rows - possible?
    By Geoffo123 in forum Excel General
    Replies: 6
    Last Post: 03-20-2013, 08:13 PM
  5. [SOLVED] Macro code that hides or unhides rows in other worksheets
    By nenadmail in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-25-2012, 04:10 PM
  6. Macro that hides/unhides sheets depending on cell value
    By amelio in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-13-2011, 06:33 AM
  7. [SOLVED] Event Procedure - Pick List Choice Unhides Worksheet
    By JEFF in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-22-2005, 12:05 PM

Tags for this Thread

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