+ Reply to Thread
Results 1 to 2 of 2

hide/unhide rows based on reference to cell that contains a formula result (vlookup)

  1. #1
    Registered User
    Join Date
    mpls mn
    MS-Off Ver
    Excel 2007

    hide/unhide rows based on reference to cell that contains a formula result (vlookup)

    I the attached example, I want to use VB to hide or unhide rows 16-17 based on the result of a formula in cell O8; if it is not possible to reference the result of a formula versus a value, the I could reference cell A3 (which contains values that change) but I would want to specify that if A3 = 1, 2, 6, 7, 12, ...(~35 total discrete values) then rows 16-17 should display and otherwise should be hidden. Any help is very much appreciated.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview

    Re: hide/unhide rows based on reference to cell that contains a formula result (vlookup)

    Here's what I'd suggest: put a column in your lookup table to the far right of your values. Enter TRUE or FALSE for each desired state of visibility for that row. Point your lookup formula to that, then name cell O8: IsVisible. Try the following code:
    Please Login or Register  to view this content.
    Note that there's a better way to do this that doesn't involve selecting the rows, but I'm having a brain freeze at the moment for the correct syntax to refer to the range object. If you know what it is, then something like:
    Range("16:17").EntireRow.Hidden = FALSE

    Should do the trick without having to select. I just don't remember the proper syntax...
    If your question has been satisfactorily addressed, please consider marking it solved. Click the Thread Tools dropdown and select Mark thread as solved.
    Also, you might want to add to the user's reputation by clicking the star icon in the lower left corner of the post with the answer- it's why we do what we do...

    Thomas Lafferty

+ Reply to Thread

Thread Information

Users Browsing this Thread

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


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