+ Reply to Thread
Results 1 to 11 of 11

Checkbox macros hide and unhide selected rows

  1. #1
    Registered User
    Join Date
    10-18-2012
    Location
    new york, ny
    MS-Off Ver
    Excel 2003
    Posts
    8

    Checkbox macros hide and unhide selected rows

    Hello,

    I would like to make this sheet show the data that is checked off. If the data is not checked it should be unhidden.

    Could someone help me with this?

    Thanks,

    Jdata entry.xlsx

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Checkbox macros hide and unhide selected rows

    Hi jasonexcels,

    I've read your issue several times and - IT DOES NOT COMPUTE - what do you want??
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    08-15-2012
    Location
    Las Vegas
    MS-Off Ver
    Excel 2010
    Posts
    87

    Re: Checkbox macros hide and unhide selected rows

    I think I get what you are looking for. If the checkbox is checked then you want to show those corresponding rows. If not, then hide the rows.

    Please see that attached workbook. I switched to an ActiveX checkbox. ActiveX controls are easier to work with in my opinion.

    I created one that corresponded to your checkbox Project-Level Variables.

    I also named a range called "ProjectLevelVariables" based on the data you wanted to hide or show. I then used the following event macro for my ActiveX checkbox:

    Please Login or Register  to view this content.
    This code is in the sheet module for the corresponding sheet where the ActiveX control is.

    Let me know if this is what you were aiming for.

    I will let you finish the creation of controls and code for the rest of your boxes.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    10-18-2012
    Location
    new york, ny
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Checkbox macros hide and unhide selected rows

    g8r777,

    This is exactly what I am looking for. I didnt think ActiveX would be easier but I guess you made it look easy. Many Thanks.
    But how come I can not click on the box you created?

    And if I want the same kind of correspondence on another sheet in the same workbook how does that work out?

    Thnk you and your brain so much.

    xladept,

    thank you for replying too! any ideas on the new questions? Thanks

  5. #5
    Registered User
    Join Date
    08-15-2012
    Location
    Las Vegas
    MS-Off Ver
    Excel 2010
    Posts
    87

    Re: Checkbox macros hide and unhide selected rows

    Click on the developer tab at the top of the screen. If you are in "Design Mode" then you will not be able to check or uncheck the box. Out of "Design Mode" you should be able to have the box work properly.

    The event code (in this case "CheckBox1_Click) should be in the sheet module of the sheet where the check box is. For example, if you have a checkbox on Sheet5, the code that runs when that checkbox is clicked should be in the Sheet5 module.

    That doesn't mean that the code can only do things to Sheet5. You could always reference other sheets in the code.

    Hope that makes sense and helps.

  6. #6
    Registered User
    Join Date
    10-18-2012
    Location
    new york, ny
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Checkbox macros hide and unhide selected rows

    Yup it works like a charm except I was trying to have the selected corresponding boxes show what is selected and then hide what is not selected. so in other words show the corresponding info only if checked off. Sorry if this may be confusing. Thanks
    Last edited by Cutter; 10-20-2012 at 09:20 PM. Reason: Removed whole post quote

  7. #7
    Registered User
    Join Date
    08-15-2012
    Location
    Las Vegas
    MS-Off Ver
    Excel 2010
    Posts
    87

    Re: Checkbox macros hide and unhide selected rows

    I think you want the code to do the exact opposite of what I originally had.

    Example: Box checked, then hide corresponding rows. Boxed unchecked, show corresponding rows.

    If that is the case then this code should work.

    Please Login or Register  to view this content.
    The original code had the logic "If True then hidden = False". The new code is the opposite, i.e. "If True then hidden = True".

    If that isn't what you mean, then I am at a loss.
    Last edited by g8r777; 10-19-2012 at 01:48 AM.

  8. #8
    Registered User
    Join Date
    10-18-2012
    Location
    new york, ny
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Checkbox macros hide and unhide selected rows

    This works well. One more thing, if the subscription box is checked, how would I hide rows 16 to 27 and rows 44 to 122? And if the project lvl and subscription box was checked off to hide rows 64 to 122?

    Thnx

  9. #9
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Checkbox macros hide and unhide selected rows

    Hi jasonexcels,

    I've been working on your original post with the Standard Controls - and I've moved the controls and resized them uniformly - since it's all written, I thought that I might as well post it for you to use or not as you will. I've been looking at my original response to your post and I beg your forgiveness - that was boorish of me - hopefully this post will alleviate that! DEStd.xlsm

  10. #10
    Registered User
    Join Date
    10-18-2012
    Location
    new york, ny
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Checkbox macros hide and unhide selected rows

    Thank you both for your help. As you can tell I am very new to this. Many thanks

  11. #11
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Checkbox macros hide and unhide selected rows

    @ jasonexcels

    Welcome to the forum.

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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