+ Reply to Thread
Results 1 to 11 of 11

VBA code for Checkbox to hide and unhide rows by a specific name

  1. #1
    Registered User
    Join Date
    03-14-2017
    Location
    Denmark
    MS-Off Ver
    xxxx
    Posts
    9

    VBA code for Checkbox to hide and unhide rows by a specific name

    Hi

    Thanks for looking at my little problem.

    I'm really new to VBA coding and can't get some rows to hide when selecting a checkbox, but after a specific name e.g. stiger or nedstyrtning.

    Is there anyone who are able to help me

    Regards

  2. #2
    Registered User
    Join Date
    03-14-2017
    Location
    Denmark
    MS-Off Ver
    xxxx
    Posts
    9

    re: VBA code for Checkbox to hide and unhide rows by a specific name

    With Excel file
    Attached Files Attached Files

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

    re: VBA code for Checkbox to hide and unhide rows by a specific name

    I put the code in sheet1 where the checkbox is.
    Please Login or Register  to view this content.
    NichlasO-help-vba-code-for-checkbox-to-hide-and-unhide-rows-by-a-specific-name-test1.xlsm
    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

  4. #4
    Registered User
    Join Date
    03-14-2017
    Location
    Denmark
    MS-Off Ver
    xxxx
    Posts
    9

    re: VBA code for Checkbox to hide and unhide rows by a specific name

    Hi Tom

    Thanks for a really fast reply.

    The code hides a column and not a row.

    I like the code to hide/unhide when you mark with a "x" outside e.g. "Anvend lift" in column A when you use a checkbox.

    Is that possible?

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

    re: VBA code for Checkbox to hide and unhide rows by a specific name

    My bad, I had columns in my head instead of rows. Replace the code in the workbook I attached in my previous post with the following amended code to hide the row instead of column..
    Please Login or Register  to view this content.
    This will only work with row 6 when the checkbox is selected/unselected.

  6. #6
    Registered User
    Join Date
    03-14-2017
    Location
    Denmark
    MS-Off Ver
    xxxx
    Posts
    9

    re: VBA code for Checkbox to hide and unhide rows by a specific name

    What if I set a mark like an X in column A and only for one group?

    Stiger
    Anvend arbejdsplatform
    Anvend stillads, angiv stilladsklasse
    Anvend stillads på skrånende tag
    x Anvend lift
    Anvend faldsikringsudstyr
    x Etabler rækværk
    Etabler afspærring
    Undgå brug af personer i krankurv
    Etabler trappe
    Anvend platformstige
    Anvend materiale- eller personhejs

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

    re: VBA code for Checkbox to hide and unhide rows by a specific name

    Do you mean if you put an X in column A it will hide the row(s) with an X only?

  8. #8
    Registered User
    Join Date
    03-14-2017
    Location
    Denmark
    MS-Off Ver
    xxxx
    Posts
    9

    Re: VBA code for Checkbox to hide and unhide rows by a specific name

    yes, but I will more groups like stiger. With a different text

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

    Re: VBA code for Checkbox to hide and unhide rows by a specific name

    When I started doing this I realized that you might need a way to unhide the rows at some point so I've created 2 buttons on the sheet. One to hide rows without an X, one to unhide the rows. See if the attached is what you were wanting..
    NichlasO-autofilter-and-hide-the-input-test1.xlsm

  10. #10
    Registered User
    Join Date
    03-14-2017
    Location
    Denmark
    MS-Off Ver
    xxxx
    Posts
    9

    Re: VBA code for Checkbox to hide and unhide rows by a specific name

    Thanks mate it look really great and a big step forward, but I need to keep the headlines and be able to add line.

    And thanks for your time

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

    Re: VBA code for Checkbox to hide and unhide rows by a specific name

    I'm starting to wonder if using tables instead wouldn't be a better option in this case. That way you can just filter out (select from dropdown in header) the rows you don't want and the headers remain, and adding a row is possible.
    See attached
    NichlasO-autofilter-and-hide-the-input-test1 with table.xlsm

+ 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 Unhide Columns by specific text with checkbox
    By Doolski in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-31-2016, 02:55 PM
  2. [SOLVED] Specific macro or VBA code to hide and unhide rows
    By louvaek in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 11-17-2014, 07:36 AM
  3. Hide Unhide Rows using Checkbox
    By Huskersippi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-28-2014, 05:08 PM
  4. Checkbox to hide and unhide rows
    By xjenniex in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-08-2014, 04:42 PM
  5. Hide/Unhide rows with a checkbox on a different sheet
    By blah54 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-15-2012, 11:26 AM
  6. hide/unhide rows using checkbox
    By elfirahayu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-20-2010, 03:31 PM
  7. Hide / unhide rows with help of a checkbox
    By Hansa in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-03-2009, 12:56 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