+ Reply to Thread
Results 1 to 3 of 3

Checkboxes disable rows

  1. #1
    Registered User
    Join Date
    06-17-2010
    Location
    north carolina
    MS-Off Ver
    Excel 2003
    Posts
    1

    Checkboxes disable rows

    Hi. They layout of the excel document is this. I want a document that will create hundreds of check boxes in the first column, starting on the second row automatically when you load the document. Secondly, I need it to disable the entire row of information when you check the checkbox. I got as far as making the checkboxes dynamically, but cant figure out how to have each checkbox's onClick event be edited to perform a function for that row. So here is a quick diagram.

    [ ] column1 column2 column3 column4 etc
    [ ] column1 column2 column3 column4 etc
    [ ] column1 column2 column3 column4 etc
    [X] column1 column2 column3 column4 etc <------------row is disabled!
    [ ] column1 column2 column3 column4 etc
    [ ] column1 column2 column3 column4 etc

    And remember, I need the checkboxes added dynamically at the load of the document because this document will have content added to it quite often, so we don't have to go in and add a new row with a new checkbox and new code each time. Thanks!

  2. #2
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Need help having checkboxes disable rows

    If you use hundreds of check boxes your file size will be very big. I was suggested by Palmetto to use marlett checkboxes, which are very good alternative....
    Link 1 http://www.vbaexpress.com/kb/getarticle.php?kb_id=879
    Link 2 http://www.ozgrid.com/forum/showthread.php?t=35211

    HTH
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

  3. #3
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Checkboxes disable rows

    draozoth;

    Here are 5 subs that can help you.

    If you already have the checkboxes created, you can just assign macro "CheckBox_Click" to them.
    CheckBox_Click will determine which checkbox was clicked and lock/unlock the row that it is on.

    If you already have a macro that determines the checkbox that was clicked, just pass the checkbox object to "Lock_Row".

    Create_All_CheckBoxes will create checkboxes with the default OnAction (CheckBox_Click). You just need to pass it the row # of the last checkbox. It assumes that there are no checkboxes on the activesheet.

    Workbook_Open shows you how to call Create_All_CheckBoxes so it runs when the workbook is opened.

    Create_CheckBoxes() will ask you for the bottom row if you need it, and call Create_All_CheckBoxes()

    If you want to see how it works. Create a blank workbook, put all the subs (except Workbook_Open) in a standard module and then run "Create_CheckBoxes", then check & uncheck the checkboxes.

    Please Login or Register  to view this content.
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

+ 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