+ Reply to Thread
Results 1 to 5 of 5

Automatically Hiding Rows from True or False Value

  1. #1
    Registered User
    Join Date
    02-05-2007
    Posts
    12

    Automatically Hiding Rows from True or False Value

    I'm creating a two sheet workbook where the first sheet will have questions and checkboxes for answers to the questions being asked. If the checkbox is selected we get a True response, if not false, the resultant is placed in row a. I copy the results from sheet A to sheet B. I'm trying to work on some VB code on sheet B to automatically hide rows if a value in a cell is False. If true it is to stay visible. My code isn't working though. Can anyone help?


    Private Sub Worksheet_Calculate()
    Dim LastRow As Long, c As Range
    Application.EnableEvents = False
    LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
    On Error Resume Next
    For Each c In Range("A1:A" & LastRow)
    If c.Value = False Then
    c.EntireRow.Hidden = True
    ElseIf c.Value = True Then
    c.EntireRow.Hidden = False
    End If
    Next
    On Error GoTo 0
    Application.EnableEvents = True
    End Sub
    Attached Files Attached Files

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Automatically Hiding Rows from True or False Value

    I just copied and pasted your code in the example workbook you provided and it worked perfectly.
    Wait, I think I see a problem, if you uncheck the box, it does hide the row on the "results" sheet, but, if you check the true box after, it doesn't unhide the row. Hmmmm
    Last edited by gmr4evr1; 03-07-2015 at 08:42 PM.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Registered User
    Join Date
    02-05-2007
    Posts
    12

    Re: Automatically Hiding Rows from True or False Value

    If I make A3 be false and A4 & A5 are true it works, same if A4 false, A3 & A5 true. If a5 is false and A3 & a4 true it doesn't work.

    It also is hiding the rows above A3 which I don't want I want just the one row in question. I tried swapping True/False for 1/0 as well and same thing.

    I can't figure it out.
    Last edited by swalsh19; 03-07-2015 at 09:22 PM.

  4. #4
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Automatically Hiding Rows from True or False Value

    I don't understand why it is doing it either. Maybe someone else can take a look at it and help out.

  5. #5
    Registered User
    Join Date
    02-05-2007
    Posts
    12

    Re: Automatically Hiding Rows from True or False Value

    Can anyone help me please?

+ 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] Rows to hide/unhide when checkbox = true/false
    By PDBartlett in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-06-2014, 10:40 AM
  2. What is best to use for helper cells 0 or 1, typed true or false or =true =false
    By Gingermuppet in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-20-2014, 10:41 PM
  3. [SOLVED] in this TRUE OR FALSE function, i want desired name instead of display true or false
    By vengatvj in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-15-2013, 06:44 PM
  4. [SOLVED] Automatically Drag True/False Statement
    By alcharbonneau in forum Excel General
    Replies: 2
    Last Post: 08-23-2012, 09:27 AM
  5. Deleting rows based on True/False Criteria
    By CatherineN in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-15-2007, 02:40 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