+ Reply to Thread
Results 1 to 9 of 9

Hide a Row Based on a Cells Value

  1. #1
    Registered User
    Join Date
    06-26-2014
    Location
    Baton Rouge, Louisiana
    MS-Off Ver
    2013
    Posts
    5

    Question Hide a Row Based on a Cells Value

    I am very very new to VB but i'm in need of code that will automatically hide a row based on its value in Column A. My range in column A is A22:A37. If the value in A22 is "0" I would like to hide row 22 all together. The values in A21:A35 are populated by a formula referencing data in another worksheet. I figure this shouldn't be to hard but it's above my knowledge base.

    Many Thanks ahead of time!

  2. #2
    Registered User
    Join Date
    08-27-2013
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Hide a Row Based on a Cells Value

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-26-2014
    Location
    Baton Rouge, Louisiana
    MS-Off Ver
    2013
    Posts
    5

    Re: Hide a Row Based on a Cells Value

    Thanks for you quick response, but I pasted this into my spreadsheet's code and nothing happens. Does something have to trigger it or should it the row automatically.

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Hide a Row Based on a Cells Value

    A changing value in column A via formula will not trigger any event that a macro will detect to "automatically" perform a function. The only way to "automatically" do this would be to analyze a change at the source of the formula in column A, which you gave no information about.

  5. #5
    Registered User
    Join Date
    06-26-2014
    Location
    Baton Rouge, Louisiana
    MS-Off Ver
    2013
    Posts
    5

    Re: Hide a Row Based on a Cells Value

    Understood. below is the formula i'm using.

    my formula in "Summary" Sheet for Cell A21 reads: =IF('Rented Equipment'!B$1="Inactive",0,1)

  6. #6
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Hide a Row Based on a Cells Value

    Can I assume that if A21 links to B1 of 'Rented Equipment' then A22 links to B2, A23 links to B3, and so on.

  7. #7
    Registered User
    Join Date
    06-26-2014
    Location
    Baton Rouge, Louisiana
    MS-Off Ver
    2013
    Posts
    5

    Re: Hide a Row Based on a Cells Value

    Actually no. For every one row down on the summary tab to go 5 rows over in the rented equipment tab.

    For instance: A22 Links to G1 and A23 links to L1 etc...

    i have attached my worksheet for reference.

    Thanks!
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Hide a Row Based on a Cells Value

    This should do it "automatically". You would put this code in the Rented Equipment Sheet event.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-26-2014
    Location
    Baton Rouge, Louisiana
    MS-Off Ver
    2013
    Posts
    5

    Re: Hide a Row Based on a Cells Value

    this code does work to hide rows on the "summary" sheet when there is a change in the corresponding cell in the "rented equipment" sheet. i can also see, this is exactly what my original post was asking for, but this isn't the end result i am looking for. i apologize for the lack of info. the end result is this: when "rented equipment" sheet cell B1 = "Inactive" then "summary" sheet cell row 21 is hidden. then when "rented equipment" sheet cell B1 = "Active" then "summary" sheet cell row 21 is visible. i would like the row to toggle between visible and hidden.

    i really appreciate the assistance and again i apologize for the lack of info in my original post.

+ 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. hide certain cells based on value
    By jamied2000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-19-2014, 04:00 PM
  2. Hide Cells Based on a Value
    By schumanp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-31-2013, 06:54 PM
  3. [SOLVED] Hide cells based on value
    By boll55 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-28-2012, 02:29 AM
  4. Hide Chart based on a Cells Value
    By hawkinsr86 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-09-2012, 09:32 AM
  5. Macro to hide cells based on a value from another
    By garveyj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-12-2009, 07:09 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