+ Reply to Thread
Results 1 to 21 of 21

Creating multiple check boxes macro

  1. #1
    Registered User
    Join Date
    08-18-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    23

    Creating multiple check boxes macro

    I would like to be able to create multiple check boxes that will accomplish 2 things.

    1. When Checked will display a date in the cell one column to the right.
    2. When checked will change colors

    Secondly, since i will need to make several hundred of these I would like a macro that will allow me to define how the check box is to behave and then have a macro which will allow me to define all of the settings and then input the number of check boxes that I want and it will create that many boxes.

    I recall seeing a macro on here some time ago (at least 1 month prior but no more than 6 months prior) which allowed you to type into a form how many check boxes or option boxes you wanted to create in your workbook, and then it would create that many.

    I have searched the forum some and do not seem to be able to find this post now. Any thoughts on how I can find that post, or have another macro of your own that would accomplish the same thing.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Creating multiple check boxes macro

    Hello adamgrier,

    I wrote a macro back in April that allows the user to add checkboxes to a selected range of cells and choose the macro to run and the linked cell, if one will be used.

    What determines the date to placed in the cell to right of the checkbox? What colors do you want to use?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    08-18-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    23

    Re: Creating multiple check boxes macro

    The colors I would like to use are white if empty green if checked. The date is determined by the checkbox

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Creating multiple check boxes macro

    Rather than creating 100 checkboxes, you might want to alter the range on which this Selection Change event causes cells to act like check boxes.
    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  5. #5
    Registered User
    Join Date
    08-18-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    23

    Re: Creating multiple check boxes macro

    If I understand your post correctly you are suggesting that i eliminate the check box entirely, and just find a way that allows the cell to input a date and change colors when i click on it.

    Is my understanding correct?

    If that is your suggestion I like the idea if you can explain to me how i can make that happen

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Creating multiple check boxes macro

    With a Selection Change event like I posted, if you click on a cell (in A1:A10 in that example) the cell contents will toggle between blank and a check-mark.

    i.e. each cell acts like a checkbox.

    Your plan was to assign a macro to each of the check-boxes. The equivilant of that would be to incoporate the code into the Selection Change event.

    To impliment this idea, open the sheet's code module in the VBEditor and copy paste the code into that sheet.

  7. #7
    Registered User
    Join Date
    08-18-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    23

    Re: Creating multiple check boxes macro

    Attached you will find an example file. As parts are made they go through each work center (Listed across the top). I would like to be able to click on the cell and have it change colors and input a date. I really don't care if it is a check box
    Attached Files Attached Files

  8. #8
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Creating multiple check boxes macro

    Try clicking in D4:K21 of the attached
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    08-18-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    23

    Re: Creating multiple check boxes macro

    I got what you posted to work. I have discovered one potential problem which you may be able to help me solve. I would like to require a double click to "empty" the cell.

  10. #10
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Creating multiple check boxes macro

    I think that this will do what you want.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    08-18-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    23

    Re: Creating multiple check boxes macro

    You are being so tremendously helpful. I greatly appreciate it. Thank you.

    However, when I double click on the range it does not "empty" the cell. It does nothing at all as far as I can tell. Is there a way to tweak the code so that if i double click on a cell it will return to its original status?

  12. #12
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Creating multiple check boxes macro

    Combining a Double Click event with a Selection Change event, the Double Click won't work unless the timing is just right.

    How about this user interface?
    Double click on a cell in column A, the date is put in the first blank cell in columns D-K of that row.

    Double click on a cell in D:K, that cell becomes blank.

    Would that work for your users?

  13. #13
    Registered User
    Join Date
    08-18-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    23

    Re: Creating multiple check boxes macro

    lets make it double click on column c

  14. #14
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Creating multiple check boxes macro

    OK. This should do it.
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    08-18-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    23

    Re: Creating multiple check boxes macro

    Wow! You are good. THANK YOU THANK YOU! If you are out of patients I will stop now, but I have tweaked this file a little bit more to see about getting some new features.

    I do notice one little glitch (And that may be because I added a couple of columns to the left, but I thought that I modified the code to accommodate the changes) If there is an empty cell to the left the double click feature does not seem to work properly.

    I also have a little formatting issue in one of the columns that I have added I am pretty sure it is because I am trying to get a date and a word to display in the same column I am not sure if you can do that exactly, but I know that excel will allow something like that because you can have a cell that says Saturday Nov. 7.

    Also, a little help on the conditional formatting would be greatly appreciated as well.

    Thank you in advance.
    Attached Files Attached Files

  16. #16
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Creating multiple check boxes macro

    How about this
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    08-18-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    23

    Re: Creating multiple check boxes macro

    The function of the double click and the display of the date and color seems to work. What about the other two questions the formatting of the date in the column labeled Production Status, and the conditional formatting. Is there any way to make those things happen?

  18. #18
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Creating multiple check boxes macro

    For the Production Status try
    =IF(MAX(I4:P4)=0,"none",LOOKUP(MAX(I4:P4),I4:P4,$I$3:$P$3)&" "&TEXT(MAX(I4:P4),"m/dd"))

  19. #19
    Registered User
    Join Date
    08-18-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    23

    Re: Creating multiple check boxes macro

    That works beautifully! Thank you! How about that one little glitch where you cannot double click on the lower yellow cell and have the date and shading show up to the right (It seems like that is because it wont work if any cells are empty to the left. I need to be able for it to work with empty cells as that is something that occurs frequently.

  20. #20
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Creating multiple check boxes macro

    The attachment to post 16 will do that (once the debugging MsgBox is removed from the code)

  21. #21
    Registered User
    Join Date
    08-18-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    23

    Re: Creating multiple check boxes macro

    Working perfectly!

    Thank You so much.

+ 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