+ Reply to Thread
Results 1 to 10 of 10

Do I have to write a seperate code for each ActiveX checkbox to hide rows?

  1. #1
    Registered User
    Join Date
    11-06-2014
    Location
    Milwaukee
    MS-Off Ver
    2010
    Posts
    12

    Do I have to write a seperate code for each ActiveX checkbox to hide rows?

    I have a very large spreadsheet that has many (100+) ActiveX checkboxes, about half of the those are in control of hiding or un-hiding rows. Below is a string of codes that I have in place currently to make the page functional for my purposes but there is ALOT of code I had to write over and over (or copy and paste) for each ActiveX Control and its affiliated rows.

    My question is this: is there a way to have one code for all or do they each need to be done separately as I have done already?

    Please Login or Register  to view this content.
    You guys are the best!!! THANK YOU

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,987

    Re: Do I have to write a seperate code for each ActiveX checkbox to hide rows?

    More info is needed as to the set up of your sheet but the code below will cycle through all the checkboxes on the sheet.
    Please Login or Register  to view this content.
    If your checkboxes are numbered sequentially (and say 1-50 control the hiding/unhiding) then hopefully you can calculate the row to be hidden
    eg

    If checkbox1 hides row 19, 2 hides 20, 3 - 21 etc then
    Please Login or Register  to view this content.
    If someone has helped you then please add to their Reputation

  3. #3
    Forum Guru
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Do I have to write a seperate code for each ActiveX checkbox to hide rows?

    This works.

    Wait and I'll give you some better news.


    Please Login or Register  to view this content.

  4. #4
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Do I have to write a seperate code for each ActiveX checkbox to hide rows?

    Hi Angel

    Use a Class Module...see this Link...if you have issues implementing let me know.

    http://www.bettersolutions.com/excel...A619860332.htm
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  5. #5
    Registered User
    Join Date
    11-06-2014
    Location
    Milwaukee
    MS-Off Ver
    2010
    Posts
    12

    Re: Do I have to write a seperate code for each ActiveX checkbox to hide rows?

    So the above would be great if all of my checkboxes and row numbers followed that module however, as luck would have it that pattern doesn't follow through the rest of the sheet.

  6. #6
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Do I have to write a seperate code for each ActiveX checkbox to hide rows?

    Hi Angel

    You really should consider this
    Use a Class Module...see this Link...if you have issues implementing let me know.
    Please attach a sample file that represents what you have. The structure of your attachment should be the same structure as your actual data. Any proprietary information should be changed.

    Include in the attachment any code you're currently using (whether it works or not) and, if appropriate, an "After" worksheet that demonstrates what you wish the output to be.

    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the "Add Files"... button to locate your file for uploading.
    6. This will open a new window File Upload...Click "Select Files"
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the "Upload Files" button and wait until the file has uploaded.
    10. Click the "Done" Button.

  7. #7
    Forum Guru
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Do I have to write a seperate code for each ActiveX checkbox to hide rows?

    Sorry I had a corrupt file.

    Had to recreate it.

    Ok in the attached file.

    Type 100 into D4 and click on the button.

    The macro will create the code for 100 Checkboxes.

    Cut column A and paste into visual basic.

    Enjoy
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    11-06-2014
    Location
    Milwaukee
    MS-Off Ver
    2010
    Posts
    12

    Re: Do I have to write a seperate code for each ActiveX checkbox to hide rows?

    Wow you're amazing! I'll send tomorrow morning when I return to work. Thank you so Oooooh much!

  9. #9
    Registered User
    Join Date
    11-06-2014
    Location
    Milwaukee
    MS-Off Ver
    2010
    Posts
    12

    Re: Do I have to write a seperate code for each ActiveX checkbox to hide rows?

    As promised here is the sheet I am working on with all proprietary info removed. Don't laugh, this was my first try at doing something like this. Thank you again for your help!! I just want the specified rows to be hidden when the boxes are checked and the boxes within those rows to be hidden as well.
    Attached Files Attached Files

  10. #10
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Do I have to write a seperate code for each ActiveX checkbox to hide rows?

    Hi Angela

    Try the Code in the attached...let me know of issues.
    Attached Files Attached Files
    Last edited by jaslake; 11-20-2014 at 05:01 PM. Reason: Wrong File attached

+ 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] Conditionally Hide or deactivate code in an activeX command Button.
    By Kramxel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-26-2014, 12:19 PM
  2. Replies: 9
    Last Post: 07-31-2014, 09:56 PM
  3. [SOLVED] Hide ActiveX buttons along with rows
    By srinivassurapareddi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-16-2012, 03:01 PM
  4. Hide ActiveX Checkbox on worksheet
    By ker9 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-13-2011, 04:46 PM
  5. How do I use ActiveX controls to hide/show rows on a sheet?
    By activeXhelpPlease in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-27-2005, 05:05 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